-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split "validate old ghcs" into a separate workflow
I am not convinced this is a good idea, for the same reason that Artem wants it: complexity. I'm very worried that this will break things, although as far as I can tell it should be okay as long as nobody commits anything overriding branch protection. All branch protection rules will need to be updated to check for "Validate old ghcs post job" the same way they check for "Bootstrap post job" and "Validate post job".
- Loading branch information
Showing
3 changed files
with
161 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Validate old ghcs Skip | ||
|
||
# This Workflow is special and contains a workaround for a known limitation of GitHub CI. | ||
# | ||
# The problem: We don't want to run the "old ghcs" jobs on PRs which contain only changes | ||
# to the docs, since these jobs take a long time to complete without providing any benefit. | ||
# We therefore use path-filtering in the workflow triggers for the old ghcs jobs, namely | ||
# "paths-ignore: doc/**". But the "Validate old ghcs post job" is a required job, therefore | ||
# a PR cannot be merged unless the "Validate old ghcs post job" completes succesfully, which | ||
# it doesn't do if we filter it out. | ||
# | ||
# The solution: We use a second job with the same name which always returns the exit code 0. | ||
# The logic implemented for "required" workflows accepts if 1) at least one job with that name | ||
# runs through, AND 2) If multiple jobs of that name exist, then all jobs of that name have to | ||
# finish successfully. | ||
on: | ||
push: | ||
paths: | ||
- 'doc/**' | ||
- '**/README.md' | ||
- 'CONTRIBUTING.md' | ||
branches: | ||
- master | ||
pull_request: | ||
paths: | ||
- 'doc/**' | ||
- '**/README.md' | ||
- 'CONTRIBUTING.md' | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
validate-old-ghcs-post-job: | ||
if: always() | ||
name: Validate old ghcs post job | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
name: Validate old ghcs | ||
|
||
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. | ||
concurrency: | ||
group: ${{ github.ref }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
# Note: This workflow file contains the required job "Validate old ghcs post job". We are using path | ||
# filtering here to ignore PRs which only change documentation. This can cause a problem, see the | ||
# workflow file "old-ghcs.skip.yml" for a description of the problem and the solution provided in | ||
# that file. | ||
on: | ||
push: | ||
paths-ignore: | ||
- "doc/**" | ||
- "**/README.md" | ||
- "CONTRIBUTING.md" | ||
branches: | ||
- master | ||
pull_request: | ||
paths-ignore: | ||
- "doc/**" | ||
- "**/README.md" | ||
- "CONTRIBUTING.md" | ||
release: | ||
types: | ||
- created | ||
workflow_call: | ||
|
||
env: | ||
# We choose a stable ghc version across all os's | ||
# which will be used to do the next release | ||
GHC_FOR_RELEASE: "9.4.8" | ||
COMMON_FLAGS: "-j 2 -v" | ||
|
||
jobs: | ||
|
||
validate-old-ghcs: | ||
name: Validate old ghcs ${{ matrix.extra-ghc }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
extra-ghc: | ||
["8.4.4", "8.2.2", "8.0.2"] | ||
## GHC 7.10.3 does not install on ubuntu-22.04 with ghcup. | ||
## Older GHCs are not supported by ghcup in the first place. | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install prerequisites for old GHCs | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libncurses5 libtinfo5 | ||
- name: Install extra compiler | ||
run: ghcup install ghc ${{ matrix.extra-ghc }} | ||
|
||
- name: GHCup logs | ||
if: always() | ||
run: cat /usr/local/.ghcup/logs/* | ||
|
||
- name: Install primary compiler | ||
uses: haskell-actions/setup@v2 | ||
id: setup-haskell | ||
with: | ||
ghc-version: ${{ env.GHC_FOR_RELEASE }} | ||
cabal-version: latest | ||
|
||
- name: GHC versions | ||
run: | | ||
ghc --version | ||
"ghc-${{ matrix.extra-ghc }}" --version | ||
# As we are reusing the cached build dir from the previous step | ||
# the generated artifacts are available here, | ||
# including the cabal executable and the test suite | ||
# @@@ not any more, we don't get the cache from validate.yml | ||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
${{ steps.setup-haskell.outputs.cabal-store }} | ||
dist-* | ||
key: ${{ runner.os }}-${{ env.GHC_FOR_RELEASE }}-${{ github.sha }} | ||
restore-keys: ${{ runner.os }}-${{ env.GHC_FOR_RELEASE }}- | ||
|
||
- name: Validate build | ||
run: sh validate.sh ${{ env.COMMON_FLAGS }} -s build | ||
|
||
- name: "Validate lib-suite-extras --extra-hc ghc-${{ matrix.extra-ghc }}" | ||
env: | ||
EXTRA_GHC: ghc-${{ matrix.extra-ghc }} | ||
run: sh validate.sh ${{ env.COMMON_FLAGS }} --lib-only -s lib-suite-extras --extra-hc "${{ env.EXTRA_GHC }}" | ||
|
||
# We use this job as a summary of the workflow | ||
# It will fail if any of the previous jobs does | ||
# This way we can use it exclusively in branch protection rules | ||
# and abstract away the concrete jobs of the workflow, including their names | ||
validate-old-ghcs-post-job: | ||
if: always() | ||
name: Validate old ghcs post job | ||
runs-on: ubuntu-latest | ||
# IMPORTANT! Any job added to the workflow should be added here too | ||
# (This one is true because of the abstraction described above, and the | ||
# corresponding branch protection rules. ++bsa) | ||
needs: [validate-old-ghcs] | ||
|
||
steps: | ||
- run: | | ||
echo "jobs info: ${{ toJSON(needs) }}" | ||
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | ||
run: exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters