From d5ca6e84e6ccd543dc9a79ccc8d07b702010f491 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Fri, 28 Oct 2022 15:46:33 -0700 Subject: [PATCH] ci: Fix main workflows (#1122) This brings some workflow improvements and fixes from the `cmake` branch to `main`, as well as some unique fixes to keep gclient working, so that we can continue to accept contributions in `main` until the `cmake` merge is ready. - Fix docs build in GitHub Actions (from `cmake` branch) - Cancel workflow when a PR is updated (from `cmake` branch) - Fix docker failures caused by running as root (from `cmake` branch) - Work around exception in depot_tools on Windows - Use Windows 2019 images in GitHub Actions for compatibility with gyp - Remove Docker build on ArchLinux, which no longer supports python2 at all - (NOTE: The `cmake` branch is still building on ArchLinux. Docker builds for Arch will be restored to the `main` branch when the `cmake` branch is finally merged to `main`.) --- .github/workflows/build_and_test.yaml | 14 +++++++++--- .../custom-actions/build-docs/action.yaml | 1 - .../custom-actions/build-packager/action.yaml | 2 ++ .github/workflows/github_release.yaml | 4 ++-- docs/source/conf.py | 1 - packager/testing/dockers/ArchLinux_Dockerfile | 22 ------------------- packager/testing/dockers/test_dockers.sh | 6 ++++- 7 files changed, 20 insertions(+), 30 deletions(-) delete mode 100644 packager/testing/dockers/ArchLinux_Dockerfile diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index 208ba0b355..608b6baa44 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -15,6 +15,13 @@ on: description: "The ref to build and test." required: False +# If another instance of this workflow is started for the same PR, cancel the +# old one. If a PR is updated and a new test run is started, the old test run +# will be cancelled automatically to conserve resources. +concurrency: + group: ${{ github.workflow }}-${{ github.event.inputs.ref || github.ref }} + cancel-in-progress: true + jobs: lint: name: Lint @@ -40,9 +47,10 @@ jobs: fail-fast: false matrix: # NOTE: macos-10.15 is required for now, to work around issues with our - # build system. See related comments in + # build system. The same is true for windows-2019. See related + # comments in # .github/workflows/custom-actions/build-packager/action.yaml - os: ["ubuntu-latest", "macos-10.15", "windows-latest", "self-hosted-linux-arm64"] + os: ["ubuntu-latest", "macos-10.15", "windows-2019", "self-hosted-linux-arm64"] build_type: ["Debug", "Release"] lib_type: ["static", "shared"] include: @@ -56,7 +64,7 @@ jobs: target_arch: x64 exe_ext: "" build_type_suffix: "" - - os: windows-latest + - os: windows-2019 os_name: win target_arch: x64 exe_ext: ".exe" diff --git a/.github/workflows/custom-actions/build-docs/action.yaml b/.github/workflows/custom-actions/build-docs/action.yaml index 3b68b588eb..d2edf0199b 100644 --- a/.github/workflows/custom-actions/build-docs/action.yaml +++ b/.github/workflows/custom-actions/build-docs/action.yaml @@ -17,7 +17,6 @@ runs: python3 -m pip install \ sphinxcontrib.plantuml \ recommonmark \ - cloud_sptheme \ breathe echo "::endgroup::" diff --git a/.github/workflows/custom-actions/build-packager/action.yaml b/.github/workflows/custom-actions/build-packager/action.yaml index 0556ae86b1..a0fe8da802 100644 --- a/.github/workflows/custom-actions/build-packager/action.yaml +++ b/.github/workflows/custom-actions/build-packager/action.yaml @@ -76,6 +76,8 @@ runs: echo "${GITHUB_WORKSPACE}/depot_tools" >> $GITHUB_PATH # Bypass VPYTHON included by depot_tools. Prefer the system installation. echo "VPYTHON_BYPASS=manually managed python not supported by chrome operations" >> $GITHUB_ENV + # Work around an issue in depot_tools on Windows, where an unexpected exception type appears. + sed -e 's/except subprocess.CalledProcessError:/except:/' -i.bk depot_tools/git_cache.py echo "::endgroup::" - name: Build ninja (arm only) diff --git a/.github/workflows/github_release.yaml b/.github/workflows/github_release.yaml index 0d018670c6..937d62d566 100644 --- a/.github/workflows/github_release.yaml +++ b/.github/workflows/github_release.yaml @@ -112,7 +112,7 @@ jobs: needs: [setup, lint, draft_release] strategy: matrix: - os: ["ubuntu-latest", "macos-latest", "windows-latest", "self-hosted-linux-arm64"] + os: ["ubuntu-latest", "macos-latest", "windows-2019", "self-hosted-linux-arm64"] build_type: ["Debug", "Release"] lib_type: ["static", "shared"] include: @@ -126,7 +126,7 @@ jobs: target_arch: x64 exe_ext: "" build_type_suffix: "" - - os: windows-latest + - os: windows-2019 os_name: win target_arch: x64 exe_ext: ".exe" diff --git a/docs/source/conf.py b/docs/source/conf.py index 5a35ff599f..92aff35f9e 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -35,7 +35,6 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.githubpages', 'sphinxcontrib.plantuml', 'recommonmark', - 'cloud_sptheme.ext.table_styling', 'breathe'] # Breathe configurations. diff --git a/packager/testing/dockers/ArchLinux_Dockerfile b/packager/testing/dockers/ArchLinux_Dockerfile deleted file mode 100644 index 1b0435687e..0000000000 --- a/packager/testing/dockers/ArchLinux_Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM archlinux:latest - -# Install utilities, libraries, and dev tools. -RUN pacman -Sy --needed --noconfirm \ - core/which \ - c-ares \ - gcc git python2 python3 - -# Default to python2 because our build system is ancient. -RUN ln -sf python2 /usr/bin/python - -# Install depot_tools. -WORKDIR / -RUN git clone -b chrome/4147 https://chromium.googlesource.com/chromium/tools/depot_tools.git -RUN touch depot_tools/.disable_auto_update -ENV PATH /depot_tools:$PATH - -# Bypass VPYTHON included by depot_tools. Prefer the system installation. -ENV VPYTHON_BYPASS="manually managed python not supported by chrome operations" - -# Build and run this docker by mapping shaka-packager with -# -v "shaka-packager:/shaka-packager". diff --git a/packager/testing/dockers/test_dockers.sh b/packager/testing/dockers/test_dockers.sh index 3cf38bc4ad..29fd7e12e7 100755 --- a/packager/testing/dockers/test_dockers.sh +++ b/packager/testing/dockers/test_dockers.sh @@ -7,7 +7,11 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PACKAGER_DIR="$(dirname "$(dirname "$(dirname "$(dirname ${SCRIPT_DIR})")")")" function docker_run() { - docker run -v ${PACKAGER_DIR}:/shaka-packager -w /shaka-packager/src ${CONTAINER} "$@" + docker run \ + -v ${PACKAGER_DIR}:/shaka-packager \ + -w /shaka-packager/src \ + --user $(id -u):$(id -g) \ + ${CONTAINER} "$@" } # Command line arguments will be taken as an allowlist of OSes to run.