Skip to content

Commit dc44367

Browse files
Add CI job to build and test with stack
1 parent 33882b0 commit dc44367

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/build.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,36 @@ jobs:
3737
~/disk-cache
3838
key: repo-cache-${{ runner.os }}-nixpkgs-${{ env.cache-version }}-${{ github.run_id }}-${{ github.run_attempt }}
3939

40+
run-tests-with-stack:
41+
name: Run Tests with stack
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v3
45+
- uses: cachix/install-nix-action@v22
46+
- name: Configure
47+
run: |
48+
mkdir -p ~/repo-cache ~/disk-cache
49+
echo build --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host > .bazelrc.local
50+
- name: Get Stack snapshot install directory
51+
id: stack-snapshot
52+
# NOTE: `stack path` must run at least once prior to caching to ensure the directory
53+
# exists and is populated.
54+
run: |
55+
stack --nix path --snapshot-install-root
56+
echo "dir=$(stack --nix path --snapshot-install-root)" > "${GITHUB_OUTPUT}"
57+
- uses: actions/cache@v4
58+
with:
59+
path: ${{ steps.stack-snapshot.outputs.dir }}
60+
key: ${{ runner.os }}-stack-${{ hashFiles('**/*.cabal') }}
61+
restore-keys: ${{ runner.os }}-stack-
62+
- name: Build
63+
run: |
64+
stack --nix build
65+
- name: Test
66+
if: ${{ runner.os == 'Linux' }}
67+
run: |
68+
stack --nix test
69+
4070
run-tests-with-darwin:
4171
name: Run Tests with darwin runner
4272
runs-on: macos-11

0 commit comments

Comments
 (0)