Skip to content

Merge pull request #363 from turion/dependabot/github_actions/cachix/… #852

Merge pull request #363 from turion/dependabot/github_actions/cachix/…

Merge pull request #363 from turion/dependabot/github_actions/cachix/… #852

Workflow file for this run

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
schedule:
- cron: '23 14 * * 2'
release:
name: build
jobs:
lint:
name: "Run hlint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up HLint
uses: haskell-actions/hlint-setup@v2
with:
version: "3.6.1"
- name: Run HLint
uses: haskell-actions/hlint-run@v2
with:
fail-on: warning
fourmolu:
name: "Run fourmolu"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/run-fourmolu@v10
with:
version: "0.14.0.0"
generateMatrix:
name: "Generate matrix from cabal"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- uses: kleidukos/[email protected]
id: set-matrix
with:
cabal-file: "rhine/rhine.cabal"
ubuntu: true
version: 0.1.6.0
build-cabal:
runs-on: ubuntu-latest
needs: generateMatrix
strategy:
matrix: ${{ fromJSON(needs.generateMatrix.outputs.matrix) }}
name: Haskell GHC ${{ matrix.ghc }} cabal
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: ${{ matrix.ghc }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev
- name: Configure the build
run: |
cabal configure --enable-tests --enable-benchmarks --disable-documentation
cabal build all --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.
- name: Restore cached dependencies
uses: actions/cache/restore@v4
id: cache
env:
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-
- name: Install dependencies
# If we had an exact cache hit, the dependencies will be up to date.
if: steps.cache.outputs.cache-hit != 'true'
run: cabal build all --enable-tests --enable-benchmarks --only-dependencies
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
- name: Save cached dependencies
uses: actions/cache/save@v4
# If we had an exact cache hit, trying to save the cache would error because of key clash.
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Cabal build packages
run: cabal build all --enable-tests --enable-benchmarks -fdev
- name: Cabal test
run: cabal test all --enable-tests --test-show-details=Always
- name: Cabal bench
run: cabal bench all
build-flake:
name: Nix Flake
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Free disk space
run: |
if [ "$(uname --kernel-name)" = "Linux" ]; then
sudo rm -rf /usr/local/* /usr/share/* /opt/*
docker rmi $(docker image ls -aq)
fi
- uses: cachix/install-nix-action@v30
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: cachix/cachix-action@v15
with:
name: rhine
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Check whether .nix files are formatted
run: |
nix fmt
git diff --exit-code
- name: Build all packages
run: nix build --accept-flake-config
- name: Run tests
run: nix develop --accept-flake-config -c cabal test all
# nix flake check breaks on IFD in multi-platform flake https://github.com/NixOS/nix/issues/4265
# - run: nix flake check
cabal-check:
name: Check and format all cabal files
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: tfausak/cabal-gild-setup-action@v2
with:
version: 1.3.0.1
- run: ./cabal_check.sh
success:
name: Successfully build and test on all systems
needs:
- build-cabal
- build-flake
runs-on:
- ubuntu-latest
steps:
- run: echo "Success"