Skip to content

Updating GitHub actions [1] #89

Updating GitHub actions [1]

Updating GitHub actions [1] #89

################################################################################
### GitHub Actions curation providing quality assurance for Haskell projects
###
name: 'PHANE Integration Test CI'
################################################################################
### Actions Configuration
###
defaults:
run:
shell: bash
env:
PROJECTFILE: --project-file=config/cabal.project.integration
TESTDETAILS: --test-show-details=streaming
TESTOPTIONS: --test-options="--timeout=30s"
THISMAINEXE: PhyGraph:phyg
THISTESTEXE: PHAGE-integration-tests:integration-tests
on:
# Build every pull request, to check for regressions.
pull_request:
branches: [ main ]
# Build on branch updates
push:
branches: [ main, github-ci ]
################################################################################
### Actions: Curation
###
jobs:
################################################################################
### Check that all test cases pass
###
testing:
# NOTE:
# Do *not* include macOS in *any* benchmarking/testing build matrix!
# Only include macOS in build matrices checking for compilation success.
# - macOS consumes x10 the free Linux CI minutes
# - macOS bills at x10 the paid Linux CI minute rate
#
name: 'Test: Integration'
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: 'Clone Project'
uses: actions/checkout@v4
- name: 'Setup Haskell'
uses: haskell-actions/setup@v2
with:
ghc-version: 9.10
cabal-version: 3.12
- name: 'Cabal - Configure'
run: |
cabal update ${PROJECTFILE}
cabal clean ${PROJECTFILE}
cabal freeze ${PROJECTFILE}
cabal configure ${PROJECTFILE} --enable-tests --enable-benchmarks --disable-documentation
cabal build all ${PROJECTFILE} --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.
- name: 'Cabal - Cache [1]'
uses: actions/cache/restore@v4
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: 'Cabal - Install dependencies'
# If we had an exact cache hit, the dependencies will be up to date.
if: steps.cache.outputs.cache-hit != 'true'
run: cabal build all --only-dependencies
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
- name: 'Cabal - Cache [2]'
uses: actions/cache/save@v4
# If we had an exact cache hit, trying to save the cache would error because of key clash.
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: 'Cabal - Build'
run: |
cabal build ${THISMAINEXE} ${THISTESTEXE} ${PROJECTFILE} --only-dependencies
- name: 'Cabal - Integration Tests'
run: |
cabal test ${THISTESTEXE} ${PROJECTFILE} ${TESTDETAILS} ${TESTOPTIONS}
- name: Send mail on failure
if: ${{ failure() }}
uses: dawidd6/action-send-mail@v3
with:
# Mail server settings
ignore_cert: true
secure: true
server_address: smtp.domain.com
server_port: 465
# Sender credentials
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
# Recipient & email information
to: [email protected]
cc: [email protected]
from: PHANE ρbit
subject: "PHANE CI Failure: Integration Test-suite - job ${{ github.job }}"
body: "The continuous integration performed by GitHub Workflows has failed!\n\nInspect job ${{ github.job.name }} numbered ${{ github.job }} at:\n\n https://github.com/${{ github.repository }}actions.\n\n\nVigilantly,\n ~ PHANE ρbit"