Merge pull request #1429 from codedownio/stack-nix-ci

CI: add stack --nix workflow
This commit is contained in:
Vaibhav Sagar 2023-12-08 01:55:04 +11:00 committed by GitHub
commit 9160fe75ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 94 additions and 0 deletions

93
.github/workflows/stack-nix.yml vendored Normal file
View File

@ -0,0 +1,93 @@
name: Stack (--nix)
on:
push:
paths-ignore:
- 'demo/**'
- 'docker/**'
- 'Dockerfile'
- '.dockerignore'
- '.ghci'
- '.gitignore'
- 'images/**'
- 'notebooks/**'
- 'README.md'
- 'hie.yaml'
pull_request:
paths-ignore:
- 'demo/**'
- 'docker/**'
- 'Dockerfile'
- '.dockerignore'
- '.ghci'
- '.gitignore'
- 'images/**'
- 'notebooks/**'
- 'README.md'
- 'hie.yaml'
jobs:
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
stack-yaml:
# - 'stack/stack-8.2.yaml'
# - 'stack/stack-8.4.yaml'
# - 'stack/stack-8.6.yaml'
- 'stack/stack-8.8.yaml'
- 'stack/stack-8.10.yaml'
- 'stack/stack-9.0.yaml'
- 'stack/stack-9.2.yaml'
- 'stack/stack-9.4.yaml'
- 'stack/stack-9.6.yaml'
- 'stack.yaml'
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
- uses: haskell/actions/setup@v2
name: Setup Haskell Stack
with:
enable-stack: true
stack-version: "latest"
- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-${{ matrix.stack-yaml }}-${{ hashFiles(format('./{0}', matrix.stack-yaml)) }}
- name: Build
run: |
export "NIX_PATH=nixpkgs=$(nix run .#print-nixpkgs-master)"
stack build --nix --stack-yaml ${{matrix.stack-yaml}}
- name: Test
if: ${{ !contains(fromJSON('["stack/stack-8.8.yaml"]'), matrix.stack-yaml) }}
run: |
export "NIX_PATH=nixpkgs=$(nix run .#print-nixpkgs-master)"
stack test --nix --stack-yaml ${{matrix.stack-yaml}}
- name: Run integration test
if: ${{ !contains(fromJSON('["stack/stack-8.8.yaml"]'), matrix.stack-yaml) }}
run: |
set -e
export "NIX_PATH=nixpkgs=$(nix run .#print-nixpkgs-master)"
nix build .#jupyterlab
export PATH="$(pwd)/result/bin:$(pwd)/.local/bin:$PATH"
stack install --nix --stack-yaml ${{matrix.stack-yaml}}
ihaskell install --stack --stack-flag="--nix" --stack-flag="--stack-yaml=$(realpath ${{matrix.stack-yaml}})"
# Ensure that IHaskell notebook remains unchanged.
# Run the notebook to regenerate the outputs, then compare the new notebook to the old one.
test/acceptance.nbconvert.sh jupyter nbconvert

View File

@ -78,6 +78,7 @@
# To use in CI
inherit jupyterlab;
print-nixpkgs-master = pkgsMaster.writeShellScriptBin "print-nixpkgs-master.sh" "echo ${pkgsMaster.path}";
};
# Run the acceptance tests on each env