Make GHA config more efficient (#10383)

A few things here:

* Build the debs for single distro for each PR, so that we can see if it breaks. Do the same for develop. Building all the debs ties up the GHA workers for ages.
* Stop building the debs for release branches. Again, it takes ages, and I don't think anyone is actually going to stop and look at them. We'll know they are working when we make an RC.
* Change the configs so that if we manually cancel a workflow, it actually does something.
This commit is contained in:
Richard van der Hoff 2021-07-14 14:41:23 +01:00 committed by GitHub
parent eb3beb8f12
commit 07e0992a76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 15 deletions

View file

@ -3,28 +3,33 @@
name: Build release artifacts name: Build release artifacts
on: on:
# we build on PRs and develop to (hopefully) get early warning
# of things breaking (but only build one set of debs)
pull_request:
push: push:
# we build on develop and release branches to (hopefully) get early warning branches: ["develop"]
# of things breaking
branches: ["develop", "release-*"]
# we also rebuild on tags, so that we can be sure of picking the artifacts # we do the full build on tags.
# from the right tag.
tags: ["v*"] tags: ["v*"]
permissions: permissions:
contents: write contents: write
jobs: jobs:
# first get the list of distros to build for.
get-distros: get-distros:
name: "Calculate list of debian distros"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
- id: set-distros - id: set-distros
run: | run: |
echo "::set-output name=distros::$(scripts-dev/build_debian_packages --show-dists-json)" # if we're running from a tag, get the full list of distros; otherwise just use debian:sid
dists='["debian:sid"]'
if [[ $GITHUB_REF == refs/tags/* ]]; then
dists=$(scripts-dev/build_debian_packages --show-dists-json)
fi
echo "::set-output name=distros::$dists"
# map the step outputs to job outputs # map the step outputs to job outputs
outputs: outputs:
distros: ${{ steps.set-distros.outputs.distros }} distros: ${{ steps.set-distros.outputs.distros }}
@ -66,7 +71,7 @@ jobs:
# if it's a tag, create a release and attach the artifacts to it # if it's a tag, create a release and attach the artifacts to it
attach-assets: attach-assets:
name: "Attach assets to release" name: "Attach assets to release"
if: startsWith(github.ref, 'refs/tags/') if: ${{ !failure() && !cancelled() && startsWith(github.ref, 'refs/tags/') }}
needs: needs:
- build-debs - build-debs
- build-sdist - build-sdist

View file

@ -65,14 +65,14 @@ jobs:
# Dummy step to gate other tests on without repeating the whole list # Dummy step to gate other tests on without repeating the whole list
linting-done: linting-done:
if: ${{ always() }} # Run this even if prior jobs were skipped if: ${{ !cancelled() }} # Run this even if prior jobs were skipped
needs: [lint, lint-crlf, lint-newsfile, lint-sdist] needs: [lint, lint-crlf, lint-newsfile, lint-sdist]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- run: "true" - run: "true"
trial: trial:
if: ${{ !failure() }} # Allow previous steps to be skipped, but not fail if: ${{ !cancelled() && !failure() }} # Allow previous steps to be skipped, but not fail
needs: linting-done needs: linting-done
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@ -131,7 +131,7 @@ jobs:
|| true || true
trial-olddeps: trial-olddeps:
if: ${{ !failure() }} # Allow previous steps to be skipped, but not fail if: ${{ !cancelled() && !failure() }} # Allow previous steps to be skipped, but not fail
needs: linting-done needs: linting-done
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -156,7 +156,7 @@ jobs:
trial-pypy: trial-pypy:
# Very slow; only run if the branch name includes 'pypy' # Very slow; only run if the branch name includes 'pypy'
if: ${{ contains(github.ref, 'pypy') && !failure() }} if: ${{ contains(github.ref, 'pypy') && !failure() && !cancelled() }}
needs: linting-done needs: linting-done
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@ -185,7 +185,7 @@ jobs:
|| true || true
sytest: sytest:
if: ${{ !failure() }} if: ${{ !failure() && !cancelled() }}
needs: linting-done needs: linting-done
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
@ -245,7 +245,7 @@ jobs:
/logs/**/*.log* /logs/**/*.log*
portdb: portdb:
if: ${{ !failure() }} # Allow previous steps to be skipped, but not fail if: ${{ !failure() && !cancelled() }} # Allow previous steps to be skipped, but not fail
needs: linting-done needs: linting-done
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@ -286,7 +286,7 @@ jobs:
- run: .buildkite/scripts/test_synapse_port_db.sh - run: .buildkite/scripts/test_synapse_port_db.sh
complement: complement:
if: ${{ !failure() }} if: ${{ !failure() && !cancelled() }}
needs: linting-done needs: linting-done
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:

1
changelog.d/10383.misc Normal file
View file

@ -0,0 +1 @@
Make the Github Actions workflow configuration more efficient.