Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Make GHA config more efficient #10383

Merged
merged 4 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .github/workflows/release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,33 @@
name: Build release artifacts

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:
# we build on develop and release branches to (hopefully) get early warning
# of things breaking
branches: ["develop", "release-*"]
branches: ["develop"]

# we also rebuild on tags, so that we can be sure of picking the artifacts
# from the right tag.
# we do the full build on tags.
tags: ["v*"]

permissions:
contents: write

jobs:
# first get the list of distros to build for.
get-distros:
name: "Calculate list of debian distros"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- id: set-distros
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
outputs:
distros: ${{ steps.set-distros.outputs.distros }}
Expand Down Expand Up @@ -66,7 +71,7 @@ jobs:
# if it's a tag, create a release and attach the artifacts to it
attach-assets:
name: "Attach assets to release"
if: startsWith(github.ref, 'refs/tags/')
if: ${{ !failure() && !cancelled() && startsWith(github.ref, 'refs/tags/') }}
needs:
- build-debs
- build-sdist
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ jobs:

# Dummy step to gate other tests on without repeating the whole list
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]
runs-on: ubuntu-latest
steps:
- run: "true"

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
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
|| true

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
runs-on: ubuntu-latest
steps:
Expand All @@ -156,7 +156,7 @@ jobs:

trial-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
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -185,7 +185,7 @@ jobs:
|| true

sytest:
if: ${{ !failure() }}
if: ${{ !failure() && !cancelled() }}
needs: linting-done
runs-on: ubuntu-latest
container:
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
/logs/**/*.log*

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
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -286,7 +286,7 @@ jobs:
- run: .buildkite/scripts/test_synapse_port_db.sh

complement:
if: ${{ !failure() }}
if: ${{ !failure() && !cancelled() }}
needs: linting-done
runs-on: ubuntu-latest
container:
Expand Down
1 change: 1 addition & 0 deletions changelog.d/10383.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make the Github Actions workflow configuration more efficient.