Add substituters to CI workflows #408
This file contains hidden or 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: "CI" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build-test: | |
name: "Build & test" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
repository: input-output-hk/quickcheck-dynamic | |
# On pull_request events, we want to check out the latest commit of the | |
# PR, which is different to github.ref (the default, which would point | |
# to a "fake merge" commit). On push events, the default is fine as it | |
# refers to the pushed commit. | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
# Also ensure we have all history with all tags | |
fetch-depth: 0 | |
- name: Prepare nix | |
uses: cachix/install-nix-action@v22 | |
with: | |
extra_nix_config: | | |
accept-flake-config = true | |
log-lines = 1000 | |
trusted-public-keys = iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
substituters = https://iohk.cachix.org https://cache.iohk.io https://cache.nixos.org/ | |
- name: Github cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cabal/packages | |
~/.cabal/store | |
dist-newstyle | |
key: | | |
cabal-${{ runner.os }}-${{ hashFiles('cabal.project', 'default.nix', 'shell.nix') }} | |
restore-keys: | | |
cabal-${{ runner.os }}-${{ hashFiles('cabal.project', 'default.nix', 'shell.nix') }} | |
- name: Enter nix shell | |
uses: nicknovitski/nix-develop@v1 | |
with: | |
arguments: "github:input-output-hk/devx#ghc96" | |
- name: Formatting | |
run: fourmolu --mode check . | |
- name: Build | |
run: | | |
cabal update | |
cabal build all --ghc-options=-Werror | |
- name: Test | |
run: cabal test all | |
- name: Documentation (Haddock) | |
run: .github/workflows/ci-haddock.sh | |
- name: Upload Documentation | |
uses: actions/upload-artifact@v4 | |
with: | |
name: haddocks | |
path: ./docs | |
documentation: | |
name: Documentation | |
needs: [build-test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download generated documentation | |
uses: actions/download-artifact@v4 | |
with: | |
name: haddocks | |
path: docs | |
- name: Publish Documentation | |
if: github.event_name == 'push' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN || github.token }} | |
publish_dir: docs/ | |
enable_jekyll: true | |
force_orphan: true |