Skip to content

Add nix develop based CI workflow #24

Add nix develop based CI workflow

Add nix develop based CI workflow #24

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
STACK_CACHE_VERSION: v3
TERM: dumb
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
ghcVersion: ['ghc966', 'ghc984', 'ghc910']
steps:
- name: Free disk space
run: |
printf '\n=============================== Before ====================================\n'
sudo df --human-readable
sudo rm -rf /opt/hostedtoolcache /usr/share/dotnet /usr/local/lib/android
printf '\n================================ After ====================================\n'
sudo df --human-readable
printf '\n=============================== Memory ====================================\n'
sudo free --human
printf '\n================================ Swap =====================================\n'
sudo swapon --show
- name: Checkout
uses: actions/checkout@v4
- name: Install nix
uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
accept-flake-config = true
download-buffer-size = 512000000
- name: Cache nix
uses: cachix/cachix-action@v14
with:
name: gogol
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
# There isn't any apparent sensible way to cache stack, so this more or less
# follows the imperfect ideas in https://github.com/commercialhaskell/stack/issues/5754
- name: Cache package index
id: pantry
uses: actions/cache@v4
with:
key: ci-pantry-${{ env.STACK_CACHE_VERSION }}-${{ matrix.ghcVersion }}
restore-keys: |
ci-stack-${{ env.STACK_CACHE_VERSION }}-
path: |
~/.stack/pantry
- name: Update package index
if: steps.pantry.outputs.cache-hit != 'true'
run: |
stack update
- name: Cache ~/.stack
uses: actions/cache@v4
with:
key: ci-stack-${{ env.STACK_CACHE_VERSION }}-${{ matrix.ghcVersion }}-${{ hashFiles('stack-*.yaml.lock', '**/*.cabal') }}
restore-keys: |
ci-stack-${{ env.STACK_CACHE_VERSION }}-${{ matrix.ghcVersion }}-
path: |
~/.stack/setup-exe-cache
~/.stack/setup-exe-src
~/.stack/stack.sqlite3
~/.stack/snapshots
- name: Cache .stack-work
uses: actions/cache@v4
with:
key: ci-stack-work-${{ env.STACK_CACHE_VERSION }}-${{ matrix.ghcVersion }}
path: |
.stack-work
- name: Build dependencies
run: |
nix develop .#${{ matrix.ghcVersion }} --print-build-logs --command stack build --only-dependencies
- name: Build core libraries
run: |
nix develop .#${{ matrix.ghcVersion }} --print-build-logs --command stack build gogol gogol-core
- name: Build generator
if: matrix.ghcVersion == 'ghc910'
run: |
nix develop .#${{ matrix.ghcVersion }} --print-build-logs --command stack build ./gen
- name: Build services
run: |
nix develop .#${{ matrix.ghcVersion }} --print-build-logs --command stack build ./lib/services