ci: combine Nix jobs #6
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: CI | ||
on: | ||
pull_request: | ||
push: | ||
jobs: | ||
stack: | ||
name: stack / ghc ${{ matrix.ghc }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- ghc: "9.6.4" | ||
yaml: "stack.yaml" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
# release-24.05 | ||
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/74435c9234c751e6786c5f3fd34ff6b0f0c13bd1.tar.gz | ||
- uses: haskell-actions/setup@v2 | ||
name: Setup Haskell Stack | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
enable-stack: true | ||
stack-version: "latest" | ||
- uses: actions/cache/restore@v4 | ||
name: Cache restore ~/.stack | ||
id: cache-restore | ||
with: | ||
path: ~/.stack | ||
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.yaml }}-stack | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libpcre3-dev | ||
- name: Build | ||
run: | | ||
stack build --stack-yaml ${{matrix.yaml}} --system-ghc --test --bench --no-run-tests --no-run-benchmarks | ||
- name: Test | ||
if: always() | ||
run: stack test --stack-yaml ${{matrix.yaml}} --system-ghc | ||
- uses: actions/cache/save@v4 | ||
if: always() && steps.cache-restore.outputs.cache-hit != 'true' | ||
with: | ||
path: ~/.stack | ||
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.yaml }}-stack | ||
nix: | ||
name: nix build .#${{ matrix.output }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
include: | ||
- output: normal | ||
- output: static | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
# release-24.05 | ||
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/74435c9234c751e6786c5f3fd34ff6b0f0c13bd1.tar.gz | ||
- uses: DeterminateSystems/magic-nix-cache-action@v8 | ||
- name: Build | ||
run: nix build .#${{ matrix.output }} |