Skip to content

Commit 7e11749

Browse files
Merge pull request #132 from clash-lang/improve-ci
Small improvements to CI
2 parents fb44438 + 84a5530 commit 7e11749

File tree

8 files changed

+71
-43
lines changed

8 files changed

+71
-43
lines changed

.ci/apply_settings.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/bin/bash
22

3+
set -uo pipefail
4+
35
if [[ "$check_haddock" != @(True|False) ]]; then
46
echo "check_haddock: Expected True or False, got \"$check_haddock\"" >&2
57
exit 1
68
fi
79
sed <.ci/cabal.project.local.in >cabal.project.local "
8-
s/__CHECK_HADDOCK__/$check_haddock/"
10+
s/__CHECK_HADDOCK__/$check_haddock/
11+
s/__CLASH_VERSION__/$clash_version/"

.ci/build_docs.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
#!/bin/bash
22
set -xeou pipefail
33

4-
cabal v2-haddock \
5-
--constraint=clash-prelude==$clash_version \
6-
clash-protocols \
7-
|& tee haddock_log
4+
cabal v2-haddock all |& tee haddock_log
85

96
set +e
107

.ci/cabal.project.local.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
package *
22
documentation: __CHECK_HADDOCK__
33

4+
package clash-protocols-base
5+
documentation: False
6+
ghc-options: -Werror
7+
48
package clash-protocols
59
documentation: False
610
ghc-options: -Werror
11+
12+
constraints:
13+
clash-prelude == __CLASH_VERSION__

.ci/test_cabal.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
set -xeou pipefail
33

4-
cabal v2-run unittests --constraint=clash-prelude==$clash_version -fci --enable-tests
5-
cabal v2-run doctests --constraint=clash-prelude==$clash_version -fci --enable-tests
6-
cabal v2-sdist clash-protocols
4+
cabal v2-run unittests --enable-tests
5+
cabal v2-run doctests --enable-tests
6+
cabal v2-sdist all

.github/workflows/ci.yml

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: CI
22

3-
# Trigger the workflow on all pull requests and pushes/merges to master branch
3+
# Trigger the workflow on all pull requests and pushes/merges to main branch
44
on:
55
pull_request:
66
push:
7-
branches: [master]
7+
branches: [main]
88

99

1010
concurrency:
@@ -22,13 +22,19 @@ jobs:
2222
- name: Setup Stack / GHC
2323
uses: haskell-actions/setup@v2
2424
with:
25-
ghc-version: '9.4.8'
26-
cabal-version: '3.10.2.1'
25+
ghc-version: '9.8.4'
26+
cabal-version: '3.14.1.1'
2727
enable-stack: true
2828
stack-version: 'latest'
2929

30-
- name: Cache dependencies
31-
uses: actions/cache@v4
30+
# Ask Stack to use system GHC instead of installing its own copy
31+
- name: Use system GHC
32+
run: |
33+
stack config set system-ghc --global true
34+
35+
- name: Restore cached dependencies
36+
uses: actions/cache/restore@v4
37+
id: cache
3238
with:
3339
path: ~/.stack
3440
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-${{ github.sha }}
@@ -37,10 +43,19 @@ jobs:
3743
${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-
3844
${{ runner.os }}-ghc-${{ matrix.ghc }}-
3945
40-
# Ask Stack to use system GHC instead of installing its own copy
41-
- name: Use system GHC
42-
run: |
43-
stack config set system-ghc --global true
46+
- name: Install dependencies
47+
run: stack build --test --only-dependencies
48+
49+
# Cache dependencies already at this point, so that we do not have to
50+
# rebuild them should the subsequent steps fail
51+
- name: Save cached dependencies
52+
uses: actions/cache/save@v4
53+
# Trying to save over an existing cache gives distracting
54+
# "Warning: Cache save failed." since they are immutable
55+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
56+
with:
57+
path: ~/.stack
58+
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-${{ github.sha }}
4459

4560
- name: Test with Stack
4661
run: |
@@ -56,7 +71,7 @@ jobs:
5671
clash:
5772
- "1.8.2"
5873
cabal:
59-
- "3.10"
74+
- "3.14.1.1"
6075
ghc:
6176
- "9.0.2"
6277
- "9.2.8"
@@ -65,11 +80,11 @@ jobs:
6580
- "9.10.1"
6681
include:
6782
- check_haddock: "False"
68-
- ghc: "9.6.4"
83+
- ghc: "9.6.6"
6984
check_haddock: "True"
7085
os: "ubuntu-latest"
7186
clash: "1.8.2"
72-
cabal: "3.10"
87+
cabal: "3.14.1.1"
7388

7489
env:
7590
check_haddock: ${{ matrix.check_haddock }}
@@ -95,8 +110,14 @@ jobs:
95110
cabal v2-freeze
96111
mv cabal.project.freeze frozen
97112
98-
- name: Cache dependencies
99-
uses: actions/cache@v4
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 }}
100121
with:
101122
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
102123
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
@@ -105,9 +126,23 @@ jobs:
105126
${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-
106127
${{ runner.os }}-ghc-${{ matrix.ghc }}-
107128
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+
108143
- name: Build
109144
run: |
110-
cabal build all --constraint=clash-prelude==$clash_version -fci
145+
cabal v2-build all --enable-tests
111146
112147
- name: Test
113148
run: |

clash-protocols-base/clash-protocols-base.cabal

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ license-file: LICENSE
99
author: Martijn Bastiaan, QBayLogic B.V.
1010
maintainer: Martijn Bastiaan <[email protected]>
1111

12-
flag ci
13-
Description: Running on CI? Used to set fail-on-warning flag.
14-
Manual: True
15-
Default: False
16-
1712
flag large-tuples
1813
description:
1914
Generate instances for classes such as `Units` and `TaggedBundle` for tuples
@@ -75,9 +70,6 @@ common common-options
7570
-- a no-specialize pragma to every function with a blackbox.
7671
-fno-worker-wrapper
7772

78-
if flag(ci)
79-
ghc-options: -Werror
80-
8173
default-language: Haskell2010
8274
build-depends:
8375
base >= 4.15.0.0,

clash-protocols/clash-protocols.cabal

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ data-files:
2020
src/Protocols/Hedgehog.hs
2121
src/Protocols/Hedgehog/*.hs
2222

23-
flag ci
24-
Description: Running on CI? Used to set fail-on-warning flag.
25-
Manual: True
26-
Default: False
27-
2823
flag large-tuples
2924
description:
3025
Generate instances for classes such as `Units` and `TaggedBundle` for tuples
@@ -86,9 +81,6 @@ common common-options
8681
-- a no-specialize pragma to every function with a blackbox.
8782
-fno-worker-wrapper
8883

89-
if flag(ci)
90-
ghc-options: -Werror
91-
9284
default-language: Haskell2010
9385
build-depends:
9486
base >= 4.15.0.0,

stack.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
resolver: lts-21.25 # ghc-9.4.8
1+
resolver: lts-23.6 # ghc-9.8.4
22

33
packages:
44
- clash-protocols-base
@@ -7,5 +7,7 @@ packages:
77
extra-deps:
88
- git: https://github.com/cchalmers/circuit-notation.git
99
commit: 564769c52aa05b90f81bbc898b7af7087d96613d
10-
- clash-prelude-1.8.1
11-
- clash-prelude-hedgehog-1.8.1
10+
- clash-prelude-1.8.2
11+
- clash-prelude-hedgehog-1.8.2
12+
- hedgehog-1.4@sha256:9860ab34ab3951d9515c71b777d8c9c47610aae7339933e17d26ad9a4afa5618,4754
13+
- tasty-1.4.3@sha256:5b53fded93109f6704b599c3498eb73c5b0ed1a975f1912dd98b4b19c61f8bc9,2653

0 commit comments

Comments
 (0)