@@ -21,7 +21,8 @@ name: Check formatting, build and run tests
2121
2222on :
2323 push :
24- branches : main
24+ branches :
25+ - main
2526 paths :
2627 - ' .github/workflows/build-test.yaml'
2728 - ' **/Cargo.toml'
3536 - ' concordium-node/rustfmt.toml'
3637
3738 pull_request :
38- branches : main
39+ branches :
40+ - main
3941 types : [opened, synchronize, reopened, ready_for_review]
4042 paths :
4143 - ' .github/workflows/build-test.yaml'
5153 workflow_dispatch : # allow manual trigger
5254
5355env :
54- dummy : 16 # change to force cache invalidation
56+ dummy : 17 # change to force cache invalidation
5557 CARGO_TERM_COLOR : always # implicitly adds '--color=always' to all cargo commands
56- TEST_LEVEL : 1 # for stack tests
5758
5859jobs :
5960
6566 - name : Download fourmolu
6667 uses : supplypike/setup-bin@v1
6768 with :
68- uri : ' https://github.com/fourmolu/fourmolu/releases/download/v0.13.1 .0/fourmolu-0.13.1 .0-linux-x86_64'
69+ uri : ' https://github.com/fourmolu/fourmolu/releases/download/v0.18.0 .0/fourmolu-0.18.0 .0-linux-x86_64'
6970 name : ' fourmolu'
70- version : ' 0.13.1.0'
71+ version : ' 0.18.0.0'
72+
73+ - name : Download hpack
74+ run : |
75+ curl -L https://github.com/sol/hpack/releases/download/0.38.1/hpack_linux.gz -o hpack.gz
76+ gunzip hpack.gz
77+ chmod +x hpack
78+ mv hpack /usr/local/bin/
7179
7280 - name : Checkout project
7381 uses : actions/checkout@v2
7886 # needed to generate a cabal file from the package.yaml.
7987 - name : Setup the project
8088 run : |
81- stack --stack-yaml concordium-consensus/stack.yaml setup
89+ cd concordium-consensus
90+ hpack package.yaml
8291
8392 - name : Run fourmolu
8493 run : |
@@ -126,7 +135,7 @@ jobs:
126135 matrix :
127136 plan :
128137 - rust : 1.82
129- ghc : 9.6.6
138+ ghc : 9.10.2
130139
131140 steps :
132141 - name : Remove unnecessary files
@@ -141,13 +150,9 @@ jobs:
141150 - name : Install system packages and protoc
142151 run : |
143152 sudo apt-get update && sudo apt-get -y install liblmdb-dev gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64
144- wget https://github.com/google/flatbuffers/archive/refs/tags/v22.12.06.zip
145- unzip v22.12.06.zip
146- cd flatbuffers-22.12.06
147- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
148- make
149- sudo make install
150- cd ..
153+ wget https://github.com/google/flatbuffers/releases/download/v22.12.06/Linux.flatc.binary.g++-10.zip
154+ unzip Linux.flatc.binary.g++-10.zip
155+ sudo mv ./flatc /usr/bin/flatc
151156 flatc --version
152157 wget https://github.com/protocolbuffers/protobuf/releases/download/v3.15.3/protoc-3.15.3-linux-x86_64.zip
153158 unzip protoc-3.15.3-linux-x86_64.zip
@@ -173,11 +178,13 @@ jobs:
173178 ~/.cargo/git
174179 concordium-base/rust-src/target
175180 concordium-base/lib
176- concordium-consensus /smart-contracts/wasm-chain-integration/target
177- concordium-consensus /smart-contracts/lib
181+ concordium-base /smart-contracts/wasm-chain-integration/target
182+ concordium-base /smart-contracts/lib
178183 concordium-node/target
179- key : ${{ runner.os }}-${{ env.dummy }}-rust-deps-${{ matrix.plan.rust }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}
184+ collector/target
185+ key : ${{ runner.os }}-${{ env.dummy }}-rust-deps-${{ matrix.plan.rust }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}-${{ hashFiles('concordium-base/rust-src/**/*.rs','concordium-base/smart-contracts/wasm-chain-integration/**/*.rs')}}
180186 restore-keys : |
187+ ${{ runner.os }}-${{ env.dummy }}-rust-deps-${{ matrix.plan.rust }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}
181188 ${{ runner.os }}-${{ env.dummy }}-rust-deps-${{ matrix.plan.rust }}
182189
183190 # HASKELL #
@@ -188,6 +195,12 @@ jobs:
188195 # The cache entry keys depend on the GHC version and contents of 'package.yaml' and 'stack.yaml'
189196 # but will fall back to cache entries from different versions if no match is found.
190197
198+ - name : Compute cache keys
199+ id : cache-keys
200+ run : |
201+ echo "proto_hash=${{ hashFiles('**/*.proto') }}" >> $GITHUB_OUTPUT
202+ echo "base_hash=${{ hashFiles('concordium-base/**/*.hs') }}" >> $GITHUB_OUTPUT
203+
191204 - name : Cache stack global package DB
192205 id : stack-global
193206 uses : actions/cache@v4
@@ -196,14 +209,6 @@ jobs:
196209 key : ${{ runner.os }}-${{ env.dummy }}-stack-global-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}
197210 restore-keys : |
198211 ${{ runner.os }}-${{ env.dummy }}-stack-global-${{ matrix.plan.ghc }}
199- - name : Cache stack-installed programs in '~/.local/bin'
200- id : stack-programs
201- uses : actions/cache@v4
202- with :
203- path : ~/.local/bin
204- key : ${{ runner.os }}-${{ env.dummy }}-stack-programs-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}
205- restore-keys : |
206- ${{ runner.os }}-${{ env.dummy }}-stack-programs-${{ matrix.plan.ghc }}
207212 - name : Cache '.stack-work'
208213 uses : actions/cache@v4
209214 with :
@@ -213,34 +218,16 @@ jobs:
213218 concordium-consensus/.stack-work
214219 concordium-consensus/haskell-lmdb/.stack-work
215220
216- key : ${{ runner.os }}-${{ env.dummy }}-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}
221+ key : ${{ runner.os }}-${{ env.dummy }}-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}-${{ steps.cache-keys.outputs.proto_hash }}-${{ steps.cache-keys.outputs.base_hash }}
217222 restore-keys : |
223+ ${{ runner.os }}-${{ env.dummy }}-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}-${{ steps.cache-keys.outputs.proto_hash }}-
224+ ${{ runner.os }}-${{ env.dummy }}-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}-
218225 ${{ runner.os }}-${{ env.dummy }}-stack-work-${{ matrix.plan.ghc }}
219226
220- - name : Install GHC (unless it was cached)
221- if : steps.stack-programs.outputs.cache-hit != 'true' || steps.stack-global.outputs.cache-hit != 'true'
222- run : |
223- stack setup --install-ghc
224- - name : Build haskell dependencies (unless they were cached)
225- if : steps.stack-programs.outputs.cache-hit != 'true' || steps.stack-global.outputs.cache-hit != 'true'
226- run : |
227- stack build --test --bench --only-dependencies --stack-yaml concordium-consensus/stack.yaml
228-
229227 # Compile Haskell sources. This must be done before running checks or tests on the Rust sources.
230- - name : Build consensus
231- run : |
232- stack build --test --bench --force-dirty --stack-yaml concordium-consensus/stack.yaml --no-run-tests --no-run-benchmarks --ghc-options "-Werror"
233-
234- # Test Haskell sources. Could be run in parallel with the steps below.
235- - name : Test consensus
236- run : |
237- stack --stack-yaml concordium-consensus/stack.yaml test concordium-consensus:consensus --bench --no-run-benchmarks --ta --level=${TEST_LEVEL}
238- - name : Test globalstate
239- run : |
240- stack --stack-yaml concordium-consensus/stack.yaml test concordium-consensus:globalstate --bench --no-run-benchmarks --ta --level=${TEST_LEVEL}
241- - name : Test scheduler
228+ - name : Build consensus and run tests
242229 run : |
243- stack --stack-yaml concordium-consensus/stack.yaml test concordium-consensus:scheduler --bench --no-run-benchmarks
230+ stack build concordium-consensus -- test --bench --force-dirty --no-run-benchmarks --ghc-options "-Werror" --ghc-options -j
244231
245232 # RUST #
246233
0 commit comments