Merge pull request #35 from georgefst/fix-ci-5 #114
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: Haskell CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
name: main | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set user input permissions | |
run: sudo usermod -a -G input $USER | |
- name: Set up GHC | |
uses: haskell-actions/setup@v2 | |
id: setup | |
with: | |
ghc-version: '9.4' | |
cabal-version: '3.10' | |
cabal-update: true | |
- name: Install libevdev | |
run: sudo apt install -y libevdev-dev | |
- name: Configure the build | |
run: | | |
cabal configure --enable-tests --enable-benchmarks --disable-documentation | |
cabal build all --dry-run | |
- name: Restore cached dependencies | |
uses: actions/cache/restore@v3 | |
id: cache | |
env: | |
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} | |
with: | |
path: ${{ steps.setup.outputs.cabal-store }} | |
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} | |
restore-keys: ${{ env.key }}- | |
- name: Install dependencies | |
run: cabal build all --only-dependencies | |
- name: Save cached dependencies | |
uses: actions/cache/save@v3 | |
if: ${{ steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key }} | |
with: | |
path: ${{ steps.setup.outputs.cabal-store }} | |
key: ${{ steps.cache.outputs.cache-primary-key }} | |
- name: Build | |
run: cabal build all | |
- name: Run tests | |
run: | | |
cabal build test | |
sudo $(cabal list-bin test) |