44on :
55 pull_request :
66 push :
7- branches : [main]
7+ branches :
8+ - ' *'
89 workflow_dispatch :
910
1011
@@ -13,176 +14,12 @@ concurrency:
1314 cancel-in-progress : true
1415
1516jobs :
16- stack :
17- name : Stack tests
18- runs-on : ubuntu-latest
19- steps :
20- - name : Checkout
21- uses : actions/checkout@v4
22-
23- - name : Setup Stack / GHC
24- uses : haskell-actions/setup@v2
25- with :
26- ghc-version : ' 9.8.4'
27- cabal-version : ' 3.14.1.1'
28- enable-stack : true
29- stack-version : ' latest'
30-
31- # Ask Stack to use system GHC instead of installing its own copy
32- - name : Use system GHC
33- run : |
34- stack config set system-ghc --global true
35-
36- - name : Restore cached dependencies
37- uses : actions/cache/restore@v4
38- id : cache
39- with :
40- path : ~/.stack
41- key : ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-${{ github.sha }}
42- restore-keys : |
43- ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-${{ github.sha }}
44- ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-
45- ${{ runner.os }}-ghc-${{ matrix.ghc }}-
46-
47- - name : Install dependencies
48- run : stack build --test --only-dependencies
49-
50- # Cache dependencies already at this point, so that we do not have to
51- # rebuild them should the subsequent steps fail
52- - name : Save cached dependencies
53- uses : actions/cache/save@v4
54- # Trying to save over an existing cache gives distracting
55- # "Warning: Cache save failed." since they are immutable
56- if : ${{ steps.cache.outputs.cache-hit != 'true' }}
57- with :
58- path : ~/.stack
59- key : ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-${{ github.sha }}
60-
61- - name : Test with Stack
62- run : |
63- .ci/test_stack.sh
64-
65- cabal :
66- name : Cabal tests - ghc ${{ matrix.ghc }} / clash ${{ matrix.clash }} / doc ${{ matrix.check_haddock }}
67- runs-on : ${{ matrix.os }}
68- strategy :
69- fail-fast : false
70- matrix :
71- os : [ubuntu-latest]
72- clash :
73- - " 1.8.2"
74- cabal :
75- - " 3.14.1.1"
76- ghc :
77- - " 9.2.8"
78- - " 9.4.8"
79- - " 9.8.4"
80- - " 9.10.1"
81- include :
82- - check_haddock : " False"
83- - ghc : " 9.6.6"
84- check_haddock : " True"
85- os : " ubuntu-latest"
86- clash : " 1.8.2"
87- cabal : " 3.14.1.1"
88-
89- env :
90- check_haddock : ${{ matrix.check_haddock }}
91- clash_version : ${{ matrix.clash }}
92-
93- steps :
94- - name : Checkout
95- uses : actions/checkout@v4
96-
97- - name : Setup Haskell
98- uses : haskell-actions/setup@v2
99- id : setup-haskell-cabal
100- with :
101- ghc-version : ${{ matrix.ghc }}
102- cabal-version : ${{ matrix.cabal }}
103-
104- - name : Use CI specific settings
105- run : |
106- .ci/apply_settings.sh
107-
108- - name : Setup CI
109- run : |
110- cabal v2-freeze
111- mv cabal.project.freeze frozen
112-
113- - name : Restore cached dependencies
114- uses : actions/cache/restore@v4
115- id : cache
116- env :
117- key :
118- ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{
119- steps.setup-haskell.outputs.cabal-version }}${{
120- matrix.project-variant }}
121- with :
122- path : ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
123- key : ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
124- restore-keys : |
125- ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
126- ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-
127- ${{ runner.os }}-ghc-${{ matrix.ghc }}-
128-
129- - name : Install dependencies
130- run : cabal v2-build all --enable-tests --only-dependencies
131-
132- # Cache dependencies already at this point, so that we do not have to
133- # rebuild them should the subsequent steps fail
134- - name : Save cached dependencies
135- uses : actions/cache/save@v4
136- # Trying to save over an existing cache gives distracting
137- # "Warning: Cache save failed." since they are immutable
138- if : ${{ steps.cache.outputs.cache-hit != 'true' }}
139- with :
140- path : ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
141- key : ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
142-
143- - name : Build
144- run : |
145- cabal v2-build all --enable-tests
146-
147- - name : Test
148- run : |
149- .ci/test_cabal.sh
150-
151- - name : Documentation
152- if : ${{ matrix.check_haddock == 'True' }}
153- run : |
154- .ci/build_docs.sh
155-
156- fourmolu :
157- runs-on : ubuntu-latest
158- steps :
159- # Note that you must checkout your code before running haskell-actions/run-fourmolu
160- - uses : actions/checkout@v3
161- - uses : haskell-actions/run-fourmolu@v9
162- with :
163- version : " 0.14.0.0"
164- pattern : |
165- **/*.hs
166- !clash-protocols-base/src/Protocols/Plugin/Cpp.hs
167-
168- linting :
169- name : Source code linting
170- runs-on : ubuntu-latest
171- steps :
172- - name : Checkout
173- uses : actions/checkout@v4
174-
175- - name : Whitespace
176- run : |
177- .ci/test_whitespace.sh
178-
17917 packages :
18018 name : Push package to local cache
18119 runs-on : self-hosted
18220 strategy :
18321 matrix :
18422 ghc-version : [ "ghc9101", "ghc982", "ghc964" ]
185- if : github.ref == 'refs/heads/main'
18623 steps :
18724 - name : Checkout
18825 uses : actions/checkout@v4
21350 strategy :
21451 matrix :
21552 ghc-version : [ "ghc9101", "ghc982", "ghc964" ]
216- if : github.ref == 'refs/heads/main'
21753 steps :
21854 # There's no need to configure Nix, the dockerfile handling the GHA has it done for us!
21955 # If a dependencies are already cached, we can simply re-use them!
@@ -243,47 +79,3 @@ jobs:
24379 cachix authtoken $CACHIX_TOKEN
24480 nix path-info .#devShells.x86_64-linux.${{ matrix.ghc-version }}-full | cachix push clash-lang
24581
246- # Mandatory check on GitHub
247- all :
248- name : All jobs finished
249- if : always()
250- needs : [
251- cabal,
252- fourmolu,
253- linting,
254- stack,
255- packages,
256- devshells,
257- ]
258- runs-on : ubuntu-22.04
259- steps :
260- - name : Checkout
261- uses : actions/checkout@v4
262-
263- - name : Check dependencies for failures
264- run : |
265- # Test all dependencies for success/failure
266- set -x
267- success="${{ contains(needs.*.result, 'success') }}"
268- fail="${{ contains(needs.*.result, 'failure') }}"
269- set +x
270-
271- # Test whether success/fail variables contain sane values
272- if [[ "${success}" != "true" && "${success}" != "false" ]]; then exit 1; fi
273- if [[ "${fail}" != "true" && "${fail}" != "false" ]]; then exit 1; fi
274-
275- # We want to fail if one or more dependencies fail. For safety, we introduce
276- # a second check: if no dependencies succeeded something weird is going on.
277- if [[ "${fail}" == "true" || "${success}" == "false" ]]; then
278- echo "One or more dependency failed, or no dependency succeeded."
279- exit 1
280- fi
281-
282- - name : Install dependencies
283- run : |
284- sudo apt-get update
285- sudo apt-get -y install python3-yaml
286-
287- - name : Check that the 'all' job depends on all other jobs
288- run : |
289- .github/scripts/all_check.py
0 commit comments