diff --git a/.github/workflows/README.md b/.github/workflows/README.md index e27fb0d081..73b50263df 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -1,23 +1,33 @@ # GitHub Actions CI +## Actions + - `custom-actions/build-packager`: + Builds Shaka Packager. Leaves build artifacts in the "artifacts" folder. + Requires OS-dependent and build-dependent inputs. + - `custom-actions/test-packager`: + Tests Shaka Packager. Requires OS-dependent and build-dependent inputs. + - `custom-actions/build-docs`: + Builds Shaka Packager docs. + ## Workflows - On PR: - - `build_and_test.yaml`: builds and tests all combinations of OS & build - settings - - `update_docs.yaml`: builds updated docs + - `build_and_test.yaml`: + Builds and tests all combinations of OS & build settings. Also builds + docs. - On release tag: - - `draft_github_release.yaml`: creates a draft release on GitHub, triggers - common `build_and_test` workflow - - `build_and_test.yaml` builds and tests all combinations of OS & build - settings, attaches official binaries to the GitHub draft release, triggers - `publish_github_release` workflow - - `publish_github_release.yaml`: finalizes the draft and published the GitHub - release - - `docker_hub_release.yaml`: builds a Docker image to match the final GitHub - release and pushes it to Docker Hub - - `npm_release.yaml`: builds an NPM package to match the final GitHub release - and pushes it to NPM - - `update_docs.yaml`: builds updated docs, pushes them to the gh-pages branch + - `github_release.yaml`: + Creates a draft release on GitHub, builds and tests all combinations of OS + & build settings, builds docs on all OSes, attaches static release binaries + to the draft release, then fully publishes the release. + - On release published: + - `docker_hub_release.yaml`: + Builds a Docker image to match the published GitHub release, then pushes it + to Docker Hub. + - `npm_release.yaml`: + Builds an NPM package to match the published GitHub release, then pushes it + to NPM. + - `update_docs.yaml`: + Builds updated docs and pushes them to the gh-pages branch. ## Required Repo Secrets - `DOCKERHUB_CI_USERNAME`: The username of the Docker Hub CI account diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index acfca830b4..afa384aa63 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -1,16 +1,9 @@ -name: Build and Test +name: Build and Test PR # Builds and tests on all combinations of OS, build type, and library type. +# Also builds the docs. # -# Runs when a pull request is opened, or triggered from other workflows. -# -# If triggered from another workflow, optionally attaches release artifacts to a -# release, since those artifacts can't be accessed from another workflow later. -# -# If triggered from another workflow, optionally initiates another workflow -# afterward, allowing for chaining of workflows. This capability is used in the -# release process, so that the relatively-complex build_and_test workflow can be -# reused in the middle of the release process without duplication. +# Runs when a pull request is opened or updated. # # Can also be run manually for debugging purposes. on: @@ -21,16 +14,6 @@ on: ref: description: "The ref to build and test." required: False - release_id: - description: "The ID of a release to attach release artifacts." - required: False - next_workflow: - description: "The workflow to trigger next." - required: False - next_workflow_payload: - description: "JSON input parameters to send to the next workflow." - required: False - default: "{}" jobs: build_and_test: @@ -57,126 +40,35 @@ jobs: name: Build and test ${{ matrix.os_name }} ${{ matrix.build_type }} ${{ matrix.lib_type }} runs-on: ${{ matrix.os }} - env: - MACOSX_DEPLOYMENT_TARGET: "10.10" - GYP_DEFINES: "target_arch=x64 libpackager_type=${{ matrix.lib_type }}_library" - DEPOT_TOOLS_WIN_TOOLCHAIN: "0" - GYP_MSVS_VERSION: "2019" - GYP_MSVS_OVERRIDE_PATH: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise" - steps: - - name: Compute ref - # We could be building from a workflow dispatch (manual run or triggered - # by another workflow), or from a pull request. Subsequent steps can - # refer to $TARGET_REF to determine the correct ref in all cases. - run: | - echo "TARGET_REF=${{ github.event.inputs.ref || github.ref }}" >> $GITHUB_ENV - - name: Configure git to preserve line endings - # Fix issues with CRLF in test outputs on Windows by explicitly setting - # this core.autocrlf config. Without this, tests will later fail - # because the "golden" test outputs in the source code will not have - # the correct line endings. - run: | - git config --global core.autocrlf false + # 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: ${{ env.TARGET_REF }} + ref: ${{ github.event.inputs.ref || github.ref }} - - name: Install depot tools - # NOTE: can't use actions/checkout here because this is not hosted on - # GitHub. - run: | - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git - echo "${GITHUB_WORKSPACE}/depot_tools" >> $GITHUB_PATH + - name: Build docs (Linux only) + if: runner.os == 'Linux' + uses: ./src/.github/workflows/custom-actions/build-docs - - name: Set up Python - uses: actions/setup-python@v2 + - name: Build Packager + uses: ./src/.github/workflows/custom-actions/build-packager with: - python-version: 2.7 + os_name: ${{ matrix.os_name }} + lib_type: ${{ matrix.lib_type }} + build_type: ${{ matrix.build_type }} + build_type_suffix: ${{ matrix.build_type_suffix }} + exe_ext: ${{ matrix.exe_ext }} - - name: Install macOS SDK 10.3 (macOS only) - if: matrix.os_name == 'osx' - # NOTE: macOS 11 doesn't work with our (old) version of Chromium build, - # and the latest Chromium build doesn't work with Packager's build - # system. To work around this, we need an older SDK version, and to - # get that, we need an older XCode version. XCode 10.3 has SDK 10.14, - # which works. - uses: maxim-lobanov/setup-xcode@v1 + - name: Test Packager + uses: ./src/.github/workflows/custom-actions/test-packager with: - xcode-version: 10.3 - - - name: Configure gclient - run: | - depot_tools/gclient config https://github.com/google/shaka-packager.git --name=src --unmanaged - - - name: Sync gclient - run: | - depot_tools/gclient sync - - - name: Build - run: | - depot_tools/ninja -C src/out/${{ matrix.build_type }}${{ matrix.build_type_suffix }} - - - name: Test - shell: bash - run: | - # NOTE: Some of these tests must be run from the "src" directory. - cd src - if [[ '${{ matrix.os_name }}' == 'osx' ]]; then - export DYLD_FALLBACK_LIBRARY_PATH=out/${{ matrix.build_type }}${{ matrix.build_type_suffix }} - fi - set -x # So we can see what commands/tests are being executed - for i in out/${{ matrix.build_type }}${{ matrix.build_type_suffix }}/*test${{ matrix.exe_ext }}; do "$i" || exit 1; done - python out/${{ matrix.build_type }}${{ matrix.build_type_suffix }}/packager_test.py -v --libpackager_type=${{ matrix.lib_type }}_library - - - name: Prepare artifacts - if: matrix.build_type == 'Release' && matrix.lib_type == 'static' - shell: bash - run: | - mkdir artifacts - mv \ - src/out/Release${{ matrix.build_type_suffix }}/packager${{ matrix.exe_ext }} \ - artifacts/packager-${{ matrix.os_name }}${{ matrix.exe_ext }} - mv \ - src/out/Release${{ matrix.build_type_suffix }}/mpd_generator${{ matrix.exe_ext }} \ - artifacts/mpd_generator-${{ matrix.os_name }}${{ matrix.exe_ext }} - if [[ '${{ matrix.os_name }}' == 'win' ]]; then - ( - cd src/out/Release${{ matrix.build_type_suffix }} - 7z a ../../../artifacts/pssh-box-${{ matrix.os_name }}.py.zip \ - pyproto pssh-box.py - ) - else - tar -czf artifacts/pssh-box-${{ matrix.os_name }}.py.tar.gz \ - -C src/out/Release${{ matrix.build_type_suffix }} \ - pyproto pssh-box.py - fi - - - name: Attach artifacts to release - if: matrix.build_type == 'Release' && matrix.lib_type == 'static' && github.event.inputs.release_id - uses: dwenegar/upload-release-assets@v1 - env: - GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }} - with: - release_id: ${{ github.event.inputs.release_id }} - assets_path: artifacts - - launch_next_workflow: - name: Launch next workflow - if: github.event_name == 'workflow_dispatch' && github.event.inputs.next_workflow - needs: build_and_test - runs-on: ubuntu-latest - env: - GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }} - steps: - - name: Launch next workflow - run: | - echo '${{ github.event.inputs.next_workflow_payload }}' | \ - gh workflow \ - -R '${{ github.repository }}' \ - run '${{ github.event.inputs.next_workflow }}' \ - --json + lib_type: ${{ matrix.lib_type }} + build_type: ${{ matrix.build_type }} + build_type_suffix: ${{ matrix.build_type_suffix }} + exe_ext: ${{ matrix.exe_ext }} diff --git a/.github/workflows/custom-actions/build-docs/action.yaml b/.github/workflows/custom-actions/build-docs/action.yaml new file mode 100644 index 0000000000..3b68b588eb --- /dev/null +++ b/.github/workflows/custom-actions/build-docs/action.yaml @@ -0,0 +1,46 @@ +name: Build Shaka Packager Docs + +description: | + A reusable action to build Shaka Packager docs. + Leaves docs output in the "gh-pages" folder. + Only runs in Linux due to the dependency on doxygen, which we install with + apt. + +runs: + using: composite + steps: + - name: Install dependencies + shell: bash + run: | + echo "::group::Install dependencies" + sudo apt install -y doxygen + python3 -m pip install \ + sphinxcontrib.plantuml \ + recommonmark \ + cloud_sptheme \ + breathe + echo "::endgroup::" + + - name: Generate docs + shell: bash + run: | + echo "::group::Prepare output folders" + mkdir -p gh-pages + cd src + mkdir -p out + echo "::endgroup::" + echo "::group::Build Doxygen docs" + # Doxygen must run before Sphinx. Sphinx will refer to + # Doxygen-generated output when it builds its own docs. + doxygen docs/Doxyfile + echo "::endgroup::" + echo "::group::Build Sphinx docs" + # Now build the Sphinx-based docs. + make -C docs/ html + echo "::endgroup::" + echo "::group::Move ouputs" + # Now move the generated outputs. + cp -a out/sphinx/html ../gh-pages/html + cp -a out/doxygen/html ../gh-pages/docs + cp docs/index.html ../gh-pages/index.html + echo "::endgroup::" diff --git a/.github/workflows/custom-actions/build-packager/action.yaml b/.github/workflows/custom-actions/build-packager/action.yaml new file mode 100644 index 0000000000..82a2a4dc96 --- /dev/null +++ b/.github/workflows/custom-actions/build-packager/action.yaml @@ -0,0 +1,109 @@ +name: Build Shaka Packager + +description: | + A reusable action to build Shaka Packager. + Leaves build artifacts in the "artifacts" folder. + +inputs: + os_name: + description: The name of the OS (one word). Appended to artifact filenames. + required: true + lib_type: + description: A library type, either "static" or "shared". + required: true + build_type: + description: A build type, either "Debug" or "Release". + required: true + build_type_suffix: + description: A suffix to append to the build type in the output path. + required: false + default: "" + exe_ext: + description: The extension on executable files. + required: false + default: "" + +runs: + using: composite + steps: + - name: Select Xcode 10.3 and SDK 10.14 (macOS only) + # NOTE: macOS 11 doesn't work with our (old) version of Chromium build, + # and the latest Chromium build doesn't work with Packager's build + # system. To work around this, we need an older SDK version, and to + # get that, we need an older XCode version. XCode 10.3 has SDK 10.14, + # which works. + shell: bash + run: | + if [[ "${{ runner.os }}" == "macOS" ]]; then + echo "::group::Select Xcode 10.3" + sudo xcode-select -s /Applications/Xcode_10.3.app/Contents/Developer + echo "::endgroup::" + fi + + - name: Install depot tools + shell: bash + run: | + echo "::group::Install depot_tools" + git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git + echo "${GITHUB_WORKSPACE}/depot_tools" >> $GITHUB_PATH + echo "::endgroup::" + + - name: Configure gclient + shell: bash + run: | + echo "::group::Configure gclient" + gclient config https://github.com/google/shaka-packager.git --name=src --unmanaged + echo "::endgroup::" + + - name: Sync gclient + env: + MACOSX_DEPLOYMENT_TARGET: "10.10" + GYP_DEFINES: "target_arch=x64 libpackager_type=${{ inputs.lib_type }}_library" + DEPOT_TOOLS_WIN_TOOLCHAIN: "0" + GYP_MSVS_VERSION: "2019" + GYP_MSVS_OVERRIDE_PATH: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise" + shell: bash + run: | + echo "::group::Sync gclient" + gclient sync + echo "::endgroup::" + + - name: Build + shell: bash + run: | + echo "::group::Build" + ninja -C src/out/${{ inputs.build_type }}${{ inputs.build_type_suffix }} + echo "::endgroup::" + + - name: Prepare artifacts (static release only) + shell: bash + run: | + BUILD_CONFIG="${{ inputs.build_type }}-${{ inputs.lib_type }}" + if [[ "$BUILD_CONFIG" != "Release-static" ]]; then + echo "Skipping artifacts for $BUILD_CONFIG." + exit 0 + fi + echo "::group::Prepare artifacts folder" + mkdir artifacts + ARTIFACTS="$GITHUB_WORKSPACE/artifacts" + cd src/out/Release${{ inputs.build_type_suffix }} + echo "::endgroup::" + echo "::group::Copy packager" + cp packager${{ inputs.exe_ext }} \ + $ARTIFACTS/packager-${{ inputs.os_name }}${{ inputs.exe_ext }} + echo "::endgroup::" + echo "::group::Copy mpd_generator" + cp mpd_generator${{ inputs.exe_ext }} \ + $ARTIFACTS/mpd_generator-${{ inputs.os_name }}${{ inputs.exe_ext }} + echo "::endgroup::" + if [[ '${{ runner.os }}' == 'Windows' ]]; then + echo "::group::Zip pssh-box" + 7z a $ARTIFACTS/pssh-box-${{ inputs.os_name }}.py.zip \ + pyproto pssh-box.py + echo "::endgroup::" + else + echo "::group::Tar pssh-box" + tar -czf $ARTIFACTS/pssh-box-${{ inputs.os_name }}.py.tar.gz \ + pyproto pssh-box.py + echo "::endgroup::" + fi diff --git a/.github/workflows/custom-actions/test-packager/action.yaml b/.github/workflows/custom-actions/test-packager/action.yaml new file mode 100644 index 0000000000..c8a7407377 --- /dev/null +++ b/.github/workflows/custom-actions/test-packager/action.yaml @@ -0,0 +1,45 @@ +name: Test Shaka Packager + +description: | + A reusable action to test Shaka Packager. + Should be run after building Shaka Packager. + +inputs: + lib_type: + description: A library type, either "static" or "shared". + required: true + build_type: + description: A build type, either "Debug" or "Release". + required: true + build_type_suffix: + description: A suffix to append to the build type in the output path. + required: false + default: "" + exe_ext: + description: The extension on executable files. + required: false + default: "" + +runs: + using: composite + steps: + - name: Test + shell: bash + run: | + echo "::group::Prepare test environment" + # NOTE: Some of these tests must be run from the "src" directory. + cd src/ + OUTDIR=out/${{ inputs.build_type }}${{ inputs.build_type_suffix }} + if [[ '${{ runner.os }}' == 'macOS' ]]; then + export DYLD_FALLBACK_LIBRARY_PATH=$OUTDIR + fi + echo "::endgroup::" + for i in $OUTDIR/*test${{ inputs.exe_ext }}; do + echo "::group::Test $i" + "$i" || exit 1 + echo "::endgroup::" + done + echo "::group::Test $OUTDIR/packager_test.py" + python3 $OUTDIR/packager_test.py \ + -v --libpackager_type=${{ inputs.lib_type }}_library + echo "::endgroup::" diff --git a/.github/workflows/docker_hub_release.yaml b/.github/workflows/docker_hub_release.yaml index 883d880650..ef6f9cc7fe 100644 --- a/.github/workflows/docker_hub_release.yaml +++ b/.github/workflows/docker_hub_release.yaml @@ -11,7 +11,7 @@ on: workflow_dispatch: inputs: ref: - description: "The tag to release to NPM." + description: "The tag to release to Docker Hub." required: True jobs: diff --git a/.github/workflows/draft_github_release.yaml b/.github/workflows/draft_github_release.yaml deleted file mode 100644 index f17a0f04a4..0000000000 --- a/.github/workflows/draft_github_release.yaml +++ /dev/null @@ -1,86 +0,0 @@ -name: Draft GitHub Release - -# Runs when a new tag is created that looks like a version number. -# -# Creates a draft release on GitHub with the latest release notes, then chains -# to the build_and_test workflow and the publish_github_release workflow. -# -# Collectively, this will build and tests on all OSes, attach release artifacts -# to the release, and fully publish the release. -# -# 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: - draft_release: - name: Draft GitHub release - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - path: src - - - name: Compute ref - # 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 steps can refer to $TARGET_REF to determine the - # correct ref in all cases. - run: | - # Strip refs/tags/ from the input to get the tag name. - echo "TARGET_REF=${{ github.event.inputs.tag || github.ref }}" | \ - sed -e 's@refs/tags/@@' >> $GITHUB_ENV - - - name: Extract release notes - run: | - cd src - packager/tools/extract_from_changelog.py --release_notes \ - | tee ../RELEASE_NOTES.md - # This check prevents releases without appropriate changelog updates. - VERSION=$(packager/tools/extract_from_changelog.py --version) - if [[ "$VERSION" != "$TARGET_REF" ]]; then - echo "" - echo "" - echo "***** ***** *****" - echo "" - echo "Version mismatch!" - echo "Workflow is targetting $TARGET_REF," - echo "but CHANGELOG.md contains $VERSION!" - exit 1 - fi - - - name: Draft release - id: draft_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }} - with: - tag_name: ${{ env.TARGET_REF }} - release_name: ${{ env.TARGET_REF }} - body_path: RELEASE_NOTES.md - draft: true - - - name: Start build and test, then publish - run: | - cd src - gh workflow run build_and_test.yaml \ - -f 'ref=${{ env.TARGET_REF }}' \ - -f 'release_id=${{ steps.draft_release.outputs.id }}' \ - -f 'next_workflow=publish_github_release.yaml' \ - -f 'next_workflow_payload={ "release_id": "${{ steps.draft_release.outputs.id }}" }' - echo "Triggered build_and_test workflow for release ID ${{ steps.draft_release.outputs.id }}." - env: - GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }} diff --git a/.github/workflows/github_release.yaml b/.github/workflows/github_release.yaml new file mode 100644 index 0000000000..65a2c9979b --- /dev/null +++ b/.github/workflows/github_release.yaml @@ -0,0 +1,171 @@ +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: + GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }} + with: + tag_name: ${{ needs.setup.outputs.tag }} + release_name: ${{ needs.setup.outputs.tag }} + body_path: RELEASE_NOTES.md + draft: true + + build_and_test: + needs: [setup, draft_release] + strategy: + matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + build_type: ["Debug", "Release"] + lib_type: ["static", "shared"] + include: + - os: ubuntu-latest + os_name: linux + exe_ext: "" + build_type_suffix: "" + - os: macos-latest + os_name: osx + exe_ext: "" + build_type_suffix: "" + - os: windows-latest + os_name: win + exe_ext: ".exe" + # 64-bit outputs on Windows go to a different folder name. + build_type_suffix: "_x64" + + name: Build and test ${{ matrix.os_name }} ${{ matrix.build_type }} ${{ matrix.lib_type }} + 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 }} + 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: + GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }} + 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: + GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }} + with: + release_id: ${{ needs.draft_release.outputs.release_id }} diff --git a/.github/workflows/publish_github_release.yaml b/.github/workflows/publish_github_release.yaml deleted file mode 100644 index c4f6f2991c..0000000000 --- a/.github/workflows/publish_github_release.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: Publish GitHub Release - -# Fully publishes a draft release on GitHub. -# -# Triggered in a chain initiated by the draft_github_release workflow, after -# the build_and_test workflow has finished attaching release artifacts to the -# draft release. -# -# Publishing the release then triggers additional workflows for NPM, Docker -# Hub, and GitHub Pages. -# -# Can also be run manually for debugging purposes. -on: - workflow_dispatch: - inputs: - release_id: - description: "The draft release ID." - required: True - -jobs: - publish_release: - name: Publish GitHub release - runs-on: ubuntu-latest - steps: - - name: Publish release - uses: eregon/publish-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }} - with: - release_id: ${{ github.event.inputs.release_id }} diff --git a/.github/workflows/update_docs.yaml b/.github/workflows/update_docs.yaml index 5b5e896d77..36921626da 100644 --- a/.github/workflows/update_docs.yaml +++ b/.github/workflows/update_docs.yaml @@ -1,14 +1,11 @@ name: Update Docs -# Runs when a new release is published on GitHub, or when a pull request is -# opened. +# Runs when a new release is published on GitHub. # # Pushes updated docs to GitHub Pages if triggered from a release workflow. # # Can also be run manually for debugging purposes. on: - pull_request: - types: [opened, synchronize, reopened] release: types: [published] # For manual debugging: @@ -25,52 +22,29 @@ jobs: steps: - name: Compute ref id: ref - # We could be building from a workflow dispatch (manual run), release - # event, or pull request. Subsequent steps can refer to $TARGET_REF to - # determine the correct ref in all cases. + # We could be building from a workflow dispatch (manual run) or from a + # release event. Subsequent steps can refer to the "ref" output of + # this job to determine the correct ref in all cases. run: | - echo "TARGET_REF=${{ github.event.inputs.ref || github.event.release.tag_name || github.ref }}" >> $GITHUB_ENV + echo "::set-output name=ref::${{ github.event.inputs.ref || github.event.release.tag_name }}" - name: Checkout code uses: actions/checkout@v2 with: path: src - ref: ${{ env.TARGET_REF }} + ref: ${{ steps.ref.outputs.ref }} - name: Set up Python uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies - run: | - pip install wheel - pip install sphinxcontrib.plantuml - pip install recommonmark - pip install cloud_sptheme - pip install breathe - sudo apt-get install -y doxygen + - name: Build docs + uses: ./src/.github/workflows/custom-actions/build-docs - - name: Generate docs - run: | - mkdir gh-pages - cd src - mkdir out - # Doxygen must run before Sphinx. Sphinx will refer to - # Doxygen-generated output when it builds its own docs. - doxygen docs/Doxyfile - # Now build the Sphinx-based docs. - make -C docs/ html - # Now move the generated outputs. - mv out/sphinx/html ../gh-pages/html - mv out/doxygen/html ../gh-pages/docs - cp docs/index.html ../gh-pages/index.html - - - name: Deploy to gh-pages branch (releases only) - # This is skipped when testing a PR - if: github.event_name != 'pull_request' + - name: Deploy to gh-pages branch uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.SHAKA_BOT_TOKEN }} publish_dir: gh-pages - full_commit_message: Generate docs for ${{ env.TARGET_REF }} + full_commit_message: Generate docs for ${{ steps.ref.outputs.ref }} diff --git a/packager/app/test/packager_app.py b/packager/app/test/packager_app.py index 5bc97e6b98..74bef7d217 100644 --- a/packager/app/test/packager_app.py +++ b/packager/app/test/packager_app.py @@ -26,9 +26,9 @@ class PackagerApp(object): # Set this to empty for now in case GetCommandLine() is called before # Package(). self.packaging_command_line = '' - assert os.path.exists( - self.packager_binary), ('Please run from output directory, ' - 'e.g. out/Debug/packager_test.py') + assert os.path.exists(self.packager_binary), ( + 'Please run from output directory, e.g. out/Debug/packager_test.py\n' + ' Missing: ' + self.packager_binary) def _GetBinaryName(self, name): if platform.system() == 'Windows':