Merge pull request #423 from tweag/feat/cabal-dependency-update #232
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous integration | |
on: | |
push: | |
branches: | |
- master | |
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@v4 | |
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: | |
- macos-latest | |
- ubuntu-latest | |
stack_yaml: | |
- stack.yaml | |
- stack-lts-19.yaml | |
- stack-lts-20.yaml | |
- stack-lts-21.yaml | |
- stack-nightly.yaml | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: Install Stack | |
run: | | |
nix-env --file ./nixpkgs.nix --install --attr 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@v4 | |
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="$HOME/.local/bin:$PATH" | |
stack --nix exec -- ihaskell install | |
stack --nix exec -- jupyter nbconvert --to notebook --execute --inplace ./IHaskell/examples/tutorial-ihaskell-inline-r.ipynb |