Skip to content

Various CI improvements #27

Various CI improvements

Various CI improvements #27

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
# Stack
stack:
name: Stack / GHC ${{ matrix.ghc }}
runs-on: ubuntu-latest
strategy:
matrix:
ghc: ["8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.2.5", "9.4.4"]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Haskell
uses: haskell/actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
- name: General Setup
run: |
cp .ci/stack-${{ matrix.ghc }}.yaml stack.yaml
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.setup-haskell.outputs.stack-root }}/snapshots
key:
${{ runner.os }}-stack-${{ matrix.ghc }}-${{
hashFiles('prettyprinter-interp.cabal', 'stack.yaml') }}
restore-keys: |
${{ runner.os }}-stack-${{ matrix.ghc }}-
- name: Build
run : |
stack build
- name: Test
run : |
stack test
# Cabal
cabal:
name: Cabal / GHC ${{ matrix.ghc }}
runs-on: ubuntu-latest
strategy:
matrix:
ghc: ["8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.2.5", "9.4.4", "9.6.1"]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Haskell
uses: haskell/actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
- name: General Setup
run: |
cp .ci/cabal.project.local .
- name: Setup CI
run: |
cabal v2-freeze
mv cabal.project.freeze frozen
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key:
${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('frozen',
'cabal.project', 'cabal.project.local') }}
restore-keys: |
${{ runner.os }}-ghc-${{ matrix.ghc }}-
- name: Build
run: |
cabal v2-update
cabal v2-build all
- name: Test
run: |
cabal v2-run unittests
# Mechanism copied from https://github.com/clash-lang/clash-compiler/
all:
name: All jobs finished
needs:
- cabal
- stack
- saywhatnow

Check failure on line 106 in .github/workflows/ci.yaml

View workflow run for this annotation

GitHub Actions / CI

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yaml (Line: 106, Col: 9): Job 'all' depends on unknown job 'saywhatnow'.
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check dependencies for failures
run: |
# Test all dependencies for success/failure
set -x
success="${{ contains(needs.*.result, 'success') }}"
fail="${{ contains(needs.*.result, 'failure') }}"
set +x
# Test whether success/fail variables contain sane values
if [[ "${success}" != "true" && "${success}" != "false" ]]; then exit 1; fi
if [[ "${fail}" != "true" && "${fail}" != "false" ]]; then exit 1; fi
# We want to fail if one or more dependencies fail. For safety, we introduce
# a second check: if no dependencies succeeded something weird is going on.
if [[ "${fail}" == "true" || "${success}" == "false" ]]; then
echo "One or more dependency failed, or no dependency succeeded."
exit 1
fi
# Currently, ubuntu-latest already has it installed, but keep it around in
# case they ever change that
#
# - name: Install dependencies
# run: |
# sudo apt-get update
# sudo apt-get -y install python3-yaml
- name: Check that the 'all' job depends on all other jobs
run: |
.ci/all_check.py