Skip to content

Commit 41bd31a

Browse files
committed
split "validate old ghcs" into a separate workflow
I am not convinced this is a good idea, for the same reason that @ulysses4ever 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".
1 parent dd123e6 commit 41bd31a

File tree

3 files changed

+159
-61
lines changed

3 files changed

+159
-61
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Validate old ghcs Skip
2+
3+
# This Workflow is special and contains a workaround for a known limitation of GitHub CI.
4+
#
5+
# The problem: We don't want to run the "old ghcs" jobs on PRs which contain only changes
6+
# to the docs, since these jobs take a long time to complete without providing any benefit.
7+
# We therefore use path-filtering in the workflow triggers for the old ghcs jobs, namely
8+
# "paths-ignore: doc/**". But the "Validate old ghcs post job" is a required job, therefore
9+
# a PR cannot be merged unless the "Validate old ghcs post job" completes succesfully, which
10+
# it doesn't do if we filter it out.
11+
#
12+
# The solution: We use a second job with the same name which always returns the exit code 0.
13+
# The logic implemented for "required" workflows accepts if 1) at least one job with that name
14+
# runs through, AND 2) If multiple jobs of that name exist, then all jobs of that name have to
15+
# finish successfully.
16+
on:
17+
push:
18+
paths:
19+
- 'doc/**'
20+
- '**/README.md'
21+
- 'CONTRIBUTING.md'
22+
branches:
23+
- master
24+
pull_request:
25+
paths:
26+
- 'doc/**'
27+
- '**/README.md'
28+
- 'CONTRIBUTING.md'
29+
release:
30+
types:
31+
- created
32+
33+
jobs:
34+
validate-old-ghcs-post-job:
35+
if: always()
36+
name: Validate old ghcs post job
37+
runs-on: ubuntu-latest
38+
steps:
39+
- run: exit 0

.github/workflows/old-ghcs.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Validate old ghcs
2+
3+
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency.
4+
concurrency:
5+
group: ${{ github.ref }}-${{ github.workflow }}
6+
cancel-in-progress: true
7+
8+
# Note: This workflow file contains the required job "Validate post job". We are using path filtering
9+
# here to ignore PRs which only change documentation. This can cause a problem, see the workflow file
10+
# "old-ghcs.skip.yml" for a description of the problem and the solution provided in that file.
11+
on:
12+
push:
13+
paths-ignore:
14+
- "doc/**"
15+
- "**/README.md"
16+
- "CONTRIBUTING.md"
17+
branches:
18+
- master
19+
pull_request:
20+
paths-ignore:
21+
- "doc/**"
22+
- "**/README.md"
23+
- "CONTRIBUTING.md"
24+
release:
25+
types:
26+
- created
27+
workflow_call:
28+
29+
env:
30+
# We choose a stable ghc version across all os's
31+
# which will be used to do the next release
32+
GHC_FOR_RELEASE: "9.4.8"
33+
COMMON_FLAGS: "-j 2 -v"
34+
35+
jobs:
36+
37+
validate-old-ghcs:
38+
name: Validate old ghcs ${{ matrix.extra-ghc }}
39+
runs-on: ubuntu-latest
40+
41+
strategy:
42+
matrix:
43+
extra-ghc:
44+
["8.4.4", "8.2.2", "8.0.2"]
45+
## GHC 7.10.3 does not install on ubuntu-22.04 with ghcup.
46+
## Older GHCs are not supported by ghcup in the first place.
47+
fail-fast: false
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
52+
- name: Install prerequisites for old GHCs
53+
run: |
54+
sudo apt-get update
55+
sudo apt-get install libncurses5 libtinfo5
56+
57+
- name: Install extra compiler
58+
run: ghcup install ghc ${{ matrix.extra-ghc }}
59+
60+
- name: GHCup logs
61+
if: always()
62+
run: cat /usr/local/.ghcup/logs/*
63+
64+
- name: Install primary compiler
65+
uses: haskell-actions/setup@v2
66+
id: setup-haskell
67+
with:
68+
ghc-version: ${{ env.GHC_FOR_RELEASE }}
69+
cabal-version: latest
70+
71+
- name: GHC versions
72+
run: |
73+
ghc --version
74+
"ghc-${{ matrix.extra-ghc }}" --version
75+
76+
# As we are reusing the cached build dir from the previous step
77+
# the generated artifacts are available here,
78+
# including the cabal executable and the test suite
79+
- uses: actions/cache@v4
80+
with:
81+
path: |
82+
${{ steps.setup-haskell.outputs.cabal-store }}
83+
dist-*
84+
key: ${{ runner.os }}-${{ env.GHC_FOR_RELEASE }}-${{ github.sha }}
85+
restore-keys: ${{ runner.os }}-${{ env.GHC_FOR_RELEASE }}-
86+
87+
- name: Validate build
88+
run: sh validate.sh ${{ env.COMMON_FLAGS }} -s build
89+
90+
- name: "Validate lib-suite-extras --extra-hc ghc-${{ matrix.extra-ghc }}"
91+
env:
92+
EXTRA_GHC: ghc-${{ matrix.extra-ghc }}
93+
run: sh validate.sh ${{ env.COMMON_FLAGS }} --lib-only -s lib-suite-extras --extra-hc "${{ env.EXTRA_GHC }}"
94+
95+
# We use this job as a summary of the workflow
96+
# It will fail if any of the previous jobs does
97+
# This way we can use it exclusively in branch protection rules
98+
# and abstract away the concrete jobs of the workflow, including their names
99+
validate-old-ghcs-post-job:
100+
if: always()
101+
name: Validate old ghcs post job
102+
runs-on: ubuntu-latest
103+
# IMPORTANT! Any job added to the workflow should be added here too
104+
# (This one is true because of the abstraction described above, and the
105+
# corresponding branch protection rules. ++bsa)
106+
needs: [validate-old-ghcs]
107+
108+
steps:
109+
- run: |
110+
echo "jobs info: ${{ toJSON(needs) }}"
111+
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
112+
run: exit 1

.github/workflows/validate.yml

Lines changed: 8 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -221,65 +221,6 @@ jobs:
221221
if: matrix.ghc == env.GHC_FOR_SOLVER_BENCHMARKS
222222
run: sh validate.sh $FLAGS -s solver-benchmarks-run
223223

224-
validate-old-ghcs:
225-
name: Validate old ghcs ${{ matrix.extra-ghc }}
226-
runs-on: ubuntu-latest
227-
needs: validate
228-
229-
strategy:
230-
matrix:
231-
extra-ghc:
232-
["8.4.4", "8.2.2", "8.0.2"]
233-
## GHC 7.10.3 does not install on ubuntu-22.04 with ghcup.
234-
## Older GHCs are not supported by ghcup in the first place.
235-
fail-fast: false
236-
237-
steps:
238-
- uses: actions/checkout@v4
239-
240-
- name: Install prerequisites for old GHCs
241-
run: |
242-
sudo apt-get update
243-
sudo apt-get install libncurses5 libtinfo5
244-
245-
- name: Install extra compiler
246-
run: ghcup install ghc ${{ matrix.extra-ghc }}
247-
248-
- name: GHCup logs
249-
if: always()
250-
run: cat /usr/local/.ghcup/logs/*
251-
252-
- name: Install primary compiler
253-
uses: haskell-actions/setup@v2
254-
id: setup-haskell
255-
with:
256-
ghc-version: ${{ env.GHC_FOR_RELEASE }}
257-
cabal-version: latest
258-
259-
- name: GHC versions
260-
run: |
261-
ghc --version
262-
"ghc-${{ matrix.extra-ghc }}" --version
263-
264-
# As we are reusing the cached build dir from the previous step
265-
# the generated artifacts are available here,
266-
# including the cabal executable and the test suite
267-
- uses: actions/cache@v4
268-
with:
269-
path: |
270-
${{ steps.setup-haskell.outputs.cabal-store }}
271-
dist-*
272-
key: ${{ runner.os }}-${{ env.GHC_FOR_RELEASE }}-${{ github.sha }}
273-
restore-keys: ${{ runner.os }}-${{ env.GHC_FOR_RELEASE }}-
274-
275-
- name: Validate build
276-
run: sh validate.sh ${{ env.COMMON_FLAGS }} -s build
277-
278-
- name: "Validate lib-suite-extras --extra-hc ghc-${{ matrix.extra-ghc }}"
279-
env:
280-
EXTRA_GHC: ghc-${{ matrix.extra-ghc }}
281-
run: sh validate.sh ${{ env.COMMON_FLAGS }} --lib-only -s lib-suite-extras --extra-hc "${{ env.EXTRA_GHC }}"
282-
283224
build-alpine:
284225
name: Build statically linked using alpine
285226
runs-on: ubuntu-latest
@@ -396,7 +337,11 @@ jobs:
396337
if: github.ref == 'refs/heads/master'
397338

398339
# IMPORTANT! Any job added to the workflow should be added here too
399-
needs: [validate, validate-old-ghcs, build-alpine, dogfooding]
340+
# (This doesn't appear to be true, or we'd have merges with failed
341+
# bootstrap tests. The pre-merge CI check is sufficient, but we do
342+
# need validate and build-alpine to save the corresponding artifacts.
343+
# ++bsa)
344+
needs: [validate, build-alpine, dogfooding]
400345

401346
steps:
402347
- uses: actions/download-artifact@v4
@@ -437,7 +382,9 @@ jobs:
437382
name: Validate post job
438383
runs-on: ubuntu-latest
439384
# IMPORTANT! Any job added to the workflow should be added here too
440-
needs: [validate, validate-old-ghcs, build-alpine, dogfooding]
385+
# (This one is true because of the abstraction described above, and the
386+
# corresponding branch protection rules. ++bsa)
387+
needs: [validate, build-alpine, dogfooding]
441388

442389
steps:
443390
- run: |

0 commit comments

Comments
 (0)