Flakify the development shell #838
Workflow file for this run
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: Continuous integration | |
| on: [push, pull_request] | |
| env: | |
| # Bump this number to invalidate the Github-actions cache | |
| cache-invalidation-key: 0 | |
| nixpkgs-url: https://github.com/NixOS/nixpkgs/archive/574d1eac1c200690e27b8eb4e24887f8df7ac27c.tar.gz | |
| jobs: | |
| cabal-test: | |
| name: cabal test - GHC ${{ matrix.ghc-version }} | |
| strategy: | |
| matrix: | |
| ghc-version: [96, 98, 910, 912] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: cachix/install-nix-action@v15 | |
| with: | |
| nix_path: "${{ env.nixpkgs-url }}" | |
| - name: Cache Cabal dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cabal/packages | |
| ~/.cabal/store | |
| dist-newstyle | |
| key: cabal-deps-${{ runner.os }}-${{ hashFiles('flake.lock') }}-${{ matrix.ghc-version }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('linear-base.cabal') }}-${{ github.sha }} | |
| restore-keys: cabal-deps-${{ runner.os }}-${{ hashFiles('flake.lock') }}-${{ matrix.ghc-version }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('linear-base.cabal') }}- | |
| - name: Build Nix dependencies | |
| run: nix develop .#devShells.x86_64-linux.ci-"${{ matrix.ghc-version }}" --command echo '=== Nix dependencies installed ===' | |
| - name: Init Cabal's config file | |
| run: nix develop .#devShells.x86_64-linux.ci-"${{ matrix.ghc-version }}" --command cabal --config-file=/home/runner/.cabal/config user-config -f init | |
| - name: Update Cabal's database | |
| run: nix develop .#devShells.x86_64-linux.ci-"${{ matrix.ghc-version }}" --command cabal update | |
| - name: Build Cabal's dependencies | |
| run: nix develop .#devShells.x86_64-linux.ci-"${{ matrix.ghc-version }}" --command cabal build --dependencies-only | |
| - name: Build | |
| run: nix develop .#devShells.x86_64-linux.ci-"${{ matrix.ghc-version }}" --command cabal build | |
| - name: Haddock | |
| run: nix develop .#devShells.x86_64-linux.ci-"${{ matrix.ghc-version }}" --command cabal haddock | |
| - name: cabal-docspec | |
| run: nix develop .#devShells.x86_64-linux.ci-"${{ matrix.ghc-version }}" --command cabal-docspec | |
| - name: Build benchmarks | |
| run: nix develop .#devShells.x86_64-linux.ci-"${{ matrix.ghc-version }}" --command cabal build linear-base:bench:bench | |
| - name: Run benchmarks | |
| run: nix develop .#devShells.x86_64-linux.ci-"${{ matrix.ghc-version }}" --command cabal bench 2>&1 | tee benchmark_ghc${{ matrix.ghc-version }}.txt | |
| - name: Upload benchmark results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linear-base_benchmarks_ghc${{ matrix.ghc-version }} | |
| path: | | |
| benchmark_ghc${{ matrix.ghc-version }}.txt | |
| retention-days: 90 | |
| ormolu: | |
| name: check formatting with ormolu | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: cachix/install-nix-action@v15 | |
| with: | |
| nix_path: "${{ env.nixpkgs-url }}" | |
| - name: Build Nix dependencies | |
| run: nix develop .#devShells.x86_64-linux.ci-stack --command echo '=== Nix dependencies installed ===' | |
| - name: check formatting | |
| run: nix develop .#devShells.x86_64-linux.ci-stack --command ormolu -m check $(find . -type f -name "*.hs-boot" -o -name "*.hs") | |
| stack-build: | |
| name: stack build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: cachix/install-nix-action@v15 | |
| with: | |
| nix_path: "${{ env.nixpkgs-url }}" | |
| - name: Cache Stack dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.stack | |
| key: stack-deps-${{ runner.os }}-${{ hashFiles('flake.lock') }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('stack.yaml.lock', 'linear-base.cabal') }}-${{ github.sha }} | |
| restore-keys: stack-deps-${{ runner.os }}-${{ hashFiles('flake.lock') }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('stack.yaml.lock', 'linear-base.cabal') }}- | |
| - name: Build Nix dependencies | |
| run: nix develop .#devShells.x86_64-linux.ci-stack --command echo '=== Nix dependencies installed ===' | |
| - name: Build | |
| run: nix develop .#devShells.x86_64-linux.ci-stack --command stack build --pedantic --test --bench --no-run-benchmarks |