2021-06-17 04:32:05 +00:00
|
|
|
name: GitHub Release
|
|
|
|
|
|
|
|
# Runs when a new tag is created that looks like a version number.
|
|
|
|
#
|
|
|
|
# 1. Creates a draft release on GitHub with the latest release notes
|
|
|
|
# 2. On all combinations of OS, build type, and library type:
|
|
|
|
# a. builds Packager
|
|
|
|
# b. builds the docs
|
|
|
|
# c. runs all tests
|
|
|
|
# d. attaches build artifacts to the release
|
|
|
|
# 3. Fully publishes the release on GitHub
|
|
|
|
#
|
|
|
|
# Publishing the release then triggers additional workflows for NPM, Docker
|
|
|
|
# Hub, and GitHub Pages.
|
|
|
|
#
|
|
|
|
# Can also be run manually for debugging purposes.
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- "v*.*"
|
|
|
|
# For manual debugging:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
tag:
|
|
|
|
description: "An existing tag to release."
|
|
|
|
required: True
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup:
|
|
|
|
name: Setup
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
tag: ${{ steps.compute_tag.outputs.tag }}
|
|
|
|
steps:
|
|
|
|
- name: Compute tag
|
|
|
|
id: compute_tag
|
|
|
|
# We could be building from a workflow dispatch (manual run)
|
|
|
|
# or from a pushed tag. If triggered from a pushed tag, we would like
|
|
|
|
# to strip refs/tags/ off of the incoming ref and just use the tag
|
|
|
|
# name. Subsequent jobs can refer to the "tag" output of this job to
|
|
|
|
# determine the correct tag name in all cases.
|
|
|
|
run: |
|
|
|
|
# Strip refs/tags/ from the input to get the tag name, then store
|
|
|
|
# that in output.
|
|
|
|
echo "::set-output name=tag::${{ github.event.inputs.tag || github.ref }}" \
|
|
|
|
| sed -e 's@refs/tags/@@'
|
|
|
|
|
|
|
|
draft_release:
|
|
|
|
name: Create GitHub release
|
|
|
|
needs: setup
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
release_id: ${{ steps.draft_release.outputs.id }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: src
|
|
|
|
ref: ${{ needs.setup.outputs.tag }}
|
|
|
|
|
|
|
|
- name: Check changelog version
|
|
|
|
# This check prevents releases without appropriate changelog updates.
|
|
|
|
run: |
|
|
|
|
cd src
|
|
|
|
VERSION=$(packager/tools/extract_from_changelog.py --version)
|
|
|
|
if [[ "$VERSION" != "${{ needs.setup.outputs.tag }}" ]]; then
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
echo "***** ***** *****"
|
|
|
|
echo ""
|
|
|
|
echo "Version mismatch!"
|
|
|
|
echo "Workflow is targetting ${{ needs.setup.outputs.tag }},"
|
|
|
|
echo "but CHANGELOG.md contains $VERSION!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Extract release notes
|
|
|
|
run: |
|
|
|
|
cd src
|
|
|
|
packager/tools/extract_from_changelog.py --release_notes \
|
|
|
|
| tee ../RELEASE_NOTES.md
|
|
|
|
|
|
|
|
- name: Draft release
|
|
|
|
id: draft_release
|
|
|
|
uses: actions/create-release@v1
|
|
|
|
env:
|
2021-08-12 17:50:29 +00:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-06-17 04:32:05 +00:00
|
|
|
with:
|
|
|
|
tag_name: ${{ needs.setup.outputs.tag }}
|
|
|
|
release_name: ${{ needs.setup.outputs.tag }}
|
|
|
|
body_path: RELEASE_NOTES.md
|
|
|
|
draft: true
|
|
|
|
|
2021-06-18 19:23:22 +00:00
|
|
|
lint:
|
|
|
|
needs: setup
|
|
|
|
name: Lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: src
|
|
|
|
ref: ${{ needs.setup.outputs.tag }}
|
|
|
|
# This makes the merge base available for the C++ linter, so that it
|
|
|
|
# can tell which files have changed.
|
|
|
|
fetch-depth: 2
|
|
|
|
|
|
|
|
- name: Lint
|
|
|
|
uses: ./src/.github/workflows/custom-actions/lint-packager
|
|
|
|
|
2021-06-17 04:32:05 +00:00
|
|
|
build_and_test:
|
2021-06-18 19:23:22 +00:00
|
|
|
needs: [setup, lint, draft_release]
|
2021-06-17 04:32:05 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-08-26 21:02:49 +00:00
|
|
|
os: ["ubuntu-latest", "macos-latest", "windows-latest", "self-hosted-linux-arm64"]
|
2021-06-17 04:32:05 +00:00
|
|
|
build_type: ["Debug", "Release"]
|
|
|
|
lib_type: ["static", "shared"]
|
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
os_name: linux
|
2021-08-03 04:06:07 +00:00
|
|
|
target_arch: x64
|
2021-06-17 04:32:05 +00:00
|
|
|
exe_ext: ""
|
|
|
|
build_type_suffix: ""
|
|
|
|
- os: macos-latest
|
|
|
|
os_name: osx
|
2021-08-03 04:06:07 +00:00
|
|
|
target_arch: x64
|
2021-06-17 04:32:05 +00:00
|
|
|
exe_ext: ""
|
|
|
|
build_type_suffix: ""
|
|
|
|
- os: windows-latest
|
|
|
|
os_name: win
|
2021-08-03 04:06:07 +00:00
|
|
|
target_arch: x64
|
2021-06-17 04:32:05 +00:00
|
|
|
exe_ext: ".exe"
|
|
|
|
# 64-bit outputs on Windows go to a different folder name.
|
|
|
|
build_type_suffix: "_x64"
|
2021-08-26 21:02:49 +00:00
|
|
|
- os: self-hosted-linux-arm64
|
2021-08-26 16:46:21 +00:00
|
|
|
os_name: linux
|
2021-08-03 04:06:07 +00:00
|
|
|
target_arch: arm64
|
|
|
|
exe_ext: ""
|
|
|
|
build_type_suffix: ""
|
2021-06-17 04:32:05 +00:00
|
|
|
|
2021-08-26 16:46:21 +00:00
|
|
|
name: Build and test ${{ matrix.os_name }} ${{ matrix.target_arch }} ${{ matrix.build_type }} ${{ matrix.lib_type }}
|
2021-06-17 04:32:05 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Configure git to preserve line endings
|
|
|
|
# Otherwise, tests fail on Windows because "golden" test outputs will not
|
|
|
|
# have the correct line endings.
|
|
|
|
run: git config --global core.autocrlf false
|
|
|
|
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: src
|
|
|
|
ref: ${{ needs.setup.outputs.tag }}
|
|
|
|
|
|
|
|
- name: Build docs (Linux only)
|
|
|
|
if: runner.os == 'Linux'
|
|
|
|
uses: ./src/.github/workflows/custom-actions/build-docs
|
|
|
|
|
|
|
|
- name: Build Packager
|
|
|
|
uses: ./src/.github/workflows/custom-actions/build-packager
|
|
|
|
with:
|
|
|
|
os_name: ${{ matrix.os_name }}
|
2021-08-24 05:13:52 +00:00
|
|
|
target_arch: ${{ matrix.target_arch }}
|
2021-06-17 04:32:05 +00:00
|
|
|
lib_type: ${{ matrix.lib_type }}
|
|
|
|
build_type: ${{ matrix.build_type }}
|
|
|
|
build_type_suffix: ${{ matrix.build_type_suffix }}
|
|
|
|
exe_ext: ${{ matrix.exe_ext }}
|
|
|
|
|
|
|
|
- name: Test Packager
|
|
|
|
uses: ./src/.github/workflows/custom-actions/test-packager
|
|
|
|
with:
|
|
|
|
lib_type: ${{ matrix.lib_type }}
|
|
|
|
build_type: ${{ matrix.build_type }}
|
|
|
|
build_type_suffix: ${{ matrix.build_type_suffix }}
|
|
|
|
exe_ext: ${{ matrix.exe_ext }}
|
|
|
|
|
|
|
|
- name: Attach artifacts to release
|
|
|
|
if: matrix.build_type == 'Release' && matrix.lib_type == 'static'
|
|
|
|
uses: dwenegar/upload-release-assets@v1
|
|
|
|
env:
|
2021-08-12 17:50:29 +00:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-06-17 04:32:05 +00:00
|
|
|
with:
|
|
|
|
release_id: ${{ needs.draft_release.outputs.release_id }}
|
|
|
|
assets_path: artifacts
|
|
|
|
|
|
|
|
publish_release:
|
|
|
|
name: Publish GitHub release
|
|
|
|
needs: [draft_release, build_and_test]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Publish release
|
|
|
|
uses: eregon/publish-release@v1
|
|
|
|
env:
|
2021-08-12 17:50:29 +00:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-06-17 04:32:05 +00:00
|
|
|
with:
|
|
|
|
release_id: ${{ needs.draft_release.outputs.release_id }}
|