-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Haskell testing to pipeline (#61)
* 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
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
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
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." | ||
|
||
|
||
|