Add support for verifiable builds. #605
Workflow file for this run
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
name: Build and test | |
# Builds dependencies | |
# Builds and tests concordium client | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/ci.yaml' | |
- '**.hs' | |
- 'stack*.yaml' | |
- 'package.yaml' | |
- 'concordium-client.cabal' | |
- 'deps/concordium-base' | |
- 'deps/grpc-api' | |
- 'fourmolu.yaml' | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/ci.yaml' | |
- '**.hs' | |
- 'stack*.yaml' | |
- 'package.yaml' | |
- 'concordium-client.cabal' | |
- 'deps/concordium-base' | |
- 'deps/grpc-api' | |
- 'fourmolu.yaml' | |
workflow_dispatch: # allow manual trigger | |
env: | |
RUST: 1.68 | |
GHC: 9.2.7 | |
jobs: | |
fourmolu: | |
runs-on: ubuntu-latest | |
if: ${{ !github.event.pull_request.draft }} | |
steps: | |
- name: Download fourmolu | |
uses: supplypike/setup-bin@v1 | |
with: | |
uri: 'https://github.com/fourmolu/fourmolu/releases/download/v0.13.1.0/fourmolu-0.13.1.0-linux-x86_64' | |
name: 'fourmolu' | |
version: '0.13.1.0' | |
- name: Checkout project | |
uses: actions/checkout@v2 | |
- name: Run fourmolu | |
run: | | |
fourmolu --color always --mode check $(git ls-files '*.hs') | |
concordium-client-build-and-test: | |
runs-on: ubuntu-latest | |
if: ${{ !github.event.pull_request.draft }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ env.RUST }} | |
override: true | |
- uses: haskell/actions/setup@v1 | |
with: | |
ghc-version: ${{ env.GHC }} | |
enable-stack: true | |
stack-no-global: true | |
- name: Install protoc | |
run: | | |
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.15.3/protoc-3.15.3-linux-x86_64.zip | |
unzip protoc-3.15.3-linux-x86_64.zip | |
sudo mv ./bin/protoc /usr/bin/protoc | |
- name: Cache cargo and stack dependencies and targets | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
~/.stack | |
.stack-work | |
deps/concordium-base/.stack-work/ | |
deps/concordium-base/lib/ | |
deps/concordium-base/rust-src/target/release/ | |
# Cache based on dependency versions, as well as the contents of the rust dependencies. | |
# This is a bit hacky, but we do not currently version the packages religously, so we need to do something like this. | |
key: ${{ runner.os }}-rust-stack-deps-${{ env.RUST }}-${{ hashFiles('stack.yaml', 'package.yaml', 'deps/concordium-base/haskell-src/**.hs', 'deps/concordium-base/rust-src/Cargo.toml', 'deps/concordium-base/rust-src/**.rs') }} | |
- name: Stack build # build all the binaries and tests, but don't run the tests | |
run: stack build --test --no-run-tests | |
- name: Stack test # run the tests | |
run: stack build --test |