Merge pull request #149 from fpco/feature/github-actions #10
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: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
jobs: | |
build: | |
name: ${{ matrix.os }}-stack-${{ matrix.stackage }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ['ubuntu-latest', 'macos-latest'] | |
stackage: ['nightly', 'lts-21', 'lts-20'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: haskell/actions/setup@v2 | |
with: | |
enable-stack: true | |
stack-no-global: true | |
- name: Install packages | |
run: | | |
if [ ${{ matrix.os }} == "ubuntu-latest" ] ; then | |
sudo apt-get update -qq && sudo apt-get install -y gobjc++ libgnustep-base-dev libgsl-dev | |
else | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
brew install gsl || true | |
fi | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.stack | |
key: stack-${{ matrix.os }}-${{ matrix.stackage }}-${{ hashFiles('stack.yaml') }} | |
- name: Build | |
run: | | |
if [ ${{ matrix.os }} == "ubuntu-latest" ] ; then | |
stack build --stack-yaml stack-${{ matrix.stackage }}.yaml --flag inline-c:gsl-example --flag inline-c-cpp:std-vector-example | |
else | |
stack build --stack-yaml stack-${{ matrix.stackage }}.yaml --flag inline-c-cpp:std-vector-example | |
fi | |
- name: Test | |
run: | | |
if [ ${{ matrix.os }} == "ubuntu-latest" ] ; then | |
stack test --stack-yaml stack-${{ matrix.stackage }}.yaml --flag inline-c:gsl-example --flag inline-c-cpp:std-vector-example | |
else | |
stack test --stack-yaml stack-${{ matrix.stackage }}.yaml --flag inline-c-cpp:std-vector-example | |
fi |