-
Notifications
You must be signed in to change notification settings - Fork 47
77 lines (76 loc) · 2.87 KB
/
workflow.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Continuous integration
on:
- push
- pull_request
jobs:
build:
name: Build - Windows
runs-on: windows-latest
steps:
- name: Install dependencies
run: |
choco install -y haskell-stack
choco install -y r --version 4.0.0
- uses: actions/checkout@v4
- name: Get Stack snapshot install directory
id: stack-snapshot
# NOTE: `stack path` must run at least once prior to caching to ensure the directory
# exists and is populated.
run: |
stack path --snapshot-install-root
"dir=$(stack path --snapshot-install-root)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- uses: actions/cache@v3
with:
path: ${{ steps.stack-snapshot.outputs.dir }}
key: ${{ runner.os }}-stack-${{ hashFiles('**/*.cabal') }}
restore-keys: ${{ runner.os }}-stack-
- name: Build
run: |
stack build inline-r H `
--extra-lib-dirs="C:/Program files/R/R-4.0.0/bin/x64" `
--extra-include-dirs="C:/Program files/R/R-4.0.0/include"
test:
name: Build & Test - ${{ matrix.os }} - ${{ matrix.stack_yaml }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
stack_yaml: [stack.yaml, stack-lts-18.yaml, stack-lts-19.yaml]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
with:
nix_path: nixpkgs=./nixpkgs.nix
- name: Install Stack
run: |
nix-env -f. -iA nixpkgs.stack
- name: Get Stack snapshot install directory
id: stack-snapshot
# NOTE: `stack path` must run at least once prior to caching to ensure the directory
# exists and is populated.
# NOTE: The renaming of the stack.yaml file is a workaround for
# https://github.com/commercialhaskell/stack/issues/5028.
run: |
[ ${{ matrix.stack_yaml }} = stack.yaml ] || mv ${{ matrix.stack_yaml }} stack.yaml
stack --nix path --snapshot-install-root
echo "dir=$(stack --nix path --snapshot-install-root)" > "${GITHUB_OUTPUT}"
- uses: actions/cache@v3
with:
path: ${{ steps.stack-snapshot.outputs.dir }}
key: ${{ runner.os }}-stack-${{ hashFiles('**/*.cabal') }}
restore-keys: ${{ runner.os }}-stack-
- name: Build
run: |
stack --nix build
- name: Test
if: ${{ runner.os == 'Linux' }}
run: |
stack --nix test
- name: Test IHaskell jupyter notebook example
if: ${{ runner.os == 'Linux' }}
run: |
stack --nix install
export PATH=~/.local/bin:$PATH
stack --nix exec -- ihaskell install
stack --nix exec -- jupyter nbconvert --to notebook --execute --inplace ./IHaskell/examples/tutorial-ihaskell-inline-r.ipynb