Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI to use new devenv flake #250

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
11 changes: 10 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
use flake
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi

watch_file flake.nix
watch_file flake.lock
if ! use flake . --no-pure-eval
then
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi
42 changes: 30 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,42 @@ jobs:
strategy:
matrix:
os:
- macos-13 # x86_64-darwin
- macos-latest # aarch64-darwin
- ubuntu-latest # x86_64-linux
# - macos-13 # x86_64-darwin
# - macos-latest # aarch64-darwin
- ubuntu-24.04 # x86_64-linux
fail-fast: true
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v12
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v16
with:
extra-conf: accept-flake-config = true
- uses: DeterminateSystems/magic-nix-cache-action@v7
- name: Setup devenv binary cache
uses: cachix/cachix-action@v15
with:
name: devenv
- name: Install devenv
run: nix-env -if https://github.com/cachix/devenv/archive/refs/tags/v1.3.1.tar.gz
- name: Cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
uses: actions/cache@v4
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal') }}
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
- name: Update Cabal list of known packages.
run: nix develop --no-pure-eval -c cabal update
- name: Compile code ${{ matrix.ghc }}
run: nix build .#test
run: nix develop --no-pure-eval -c cabal build
- name: Run tests ${{ matrix.ghc }}
run: nix run .#test
run: nix develop --no-pure-eval -c cabal test

docker:
uses: ./.github/workflows/reusable-docker.yml
with:
push: false
# docker:
# uses: ./.github/workflows/reusable-docker.yml
# with:
# push: false
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: local
hooks:
- id: hlint
name: hlint
description: HLint gives suggestions on how to improve your source code.
entry: hlint
language: system
files: '\.l?hs$'

Loading