Skip to content

Commit

Permalink
Add Haskell testing to pipeline (#61)
Browse files Browse the repository at this point in the history
* Add testing for Haskell

* Update dependencies

* Use updated action to install ghc

* Add test feedback on Haskell pipeline

* Add sha to status

* Add permission to write statuses

* Fix incorrect status name

* Change workflow triggers
  • Loading branch information
MatBon01 authored Jun 20, 2023
1 parent e835c45 commit 3cebf99
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Haskell CI

on:
pull_request:
branches: [ "main" ]
workflow_dispatch:

permissions:
contents: read
statuses: write

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: haskell/actions/setup@v2
with:
ghc-version: '9.2.7'
cabal-version: '3.6'

- name: Cache
uses: actions/cache@v3
env:
cache-name: cache-cabal
with:
path: ~/.cabal
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: |
cabal update
cabal build --only-dependencies --enable-tests --enable-benchmarks
- name: Build
run: cabal build --enable-tests --enable-benchmarks all



- name: Set test status to pending
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: "Haskell tests"
description: "Testing Haskell code"
state: "pending"
sha: ${{github.event.pull_request.head.sha || github.sha}}
- name: Run tests
id: test
run: cabal test all
- name: Report failure status
if: ${{ failure() && steps.test.conclusion == 'failure' }}
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: "Haskell tests"
description: "Haskell tests failed"
state: "failure"
sha: ${{github.event.pull_request.head.sha || github.sha}}

- name: Report test failures
if: ${{ failure() && steps.test.conclusion == 'failure' }}
run: echo -e "::warning title=Haskell test report::Haskell tests failed."

- name: Report test success status
if: success()
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: "Haskell tests"
description: "No spelling mistakes detected"
state: "success"
sha: ${{github.event.pull_request.head.sha || github.sha}}

- name: Report test success
if: success()
run: echo "::notice title=Haskell test report::All tests passed."



0 comments on commit 3cebf99

Please sign in to comment.