haskell-gha-1.0: tests/golden/readme/expected.yaml
# Do not edit this file, it was generated by the following command:
# haskell-gha --generate --config haskell-gha.conf.yaml
#
# To regenerate it, run from the root of the repository:
# haskell-gha
#
# For more information, see https://github.com/arybczak/haskell-gha
name: CI
on:
push:
branches:
- master
pull_request:
merge_group:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow_ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
fourmolu:
name: Fourmolu
runs-on: ubuntu-26.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: haskell-actions/run-fourmolu@v13
with:
version: '0.21.0.0'
build:
name: 'GHC ${{ matrix.ghc }}, ${{ matrix.dependencies }}'
runs-on: ubuntu-26.04
timeout-minutes: 60
services:
postgres:
image: postgres:18
env:
POSTGRES_PASSWORD: postgres
ports:
- '5432:5432'
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-retries 10
strategy:
fail-fast: false
matrix:
ghc:
- '9.6.7'
- '9.10'
- '9.12'
dependencies:
- newest
- oldest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Install the system packages
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libsodium-dev
- name: Install GHC and cabal
id: setup
run: |
mkdir -p "$RUNNER_TEMP"/.ghcup/bin
curl -fsSL -o "$RUNNER_TEMP"/.ghcup/bin/ghcup "https://downloads.haskell.org/ghcup/$(uname -m)-linux-ghcup"
chmod +x "$RUNNER_TEMP"/.ghcup/bin/ghcup
export GHCUP_INSTALL_BASE_PREFIX="$RUNNER_TEMP" PATH="$RUNNER_TEMP/.ghcup/bin:$PATH"
echo "GHCUP_INSTALL_BASE_PREFIX=$RUNNER_TEMP" >> "$GITHUB_ENV"
echo "$RUNNER_TEMP/.ghcup/bin" >> "$GITHUB_PATH"
versions=$(ghcup -s vanilla list -t ghc -r)
if grep -qF -e 'ghc ${{ matrix.ghc }} ' -e 'ghc ${{ matrix.ghc }}.' <<< "$versions"; then
channel=vanilla
else
echo 'The vanilla channel of GHCup has no GHC ${{ matrix.ghc }}, so the step uses the prerelease channel.'
channel=prereleases
fi
ghcup -s "$channel" install ghc '${{ matrix.ghc }}' --set
ghcup -s vanilla install cabal 3.16.1.0 --set
cabal update
echo "ghc-version=$(ghc --numeric-version)" >> "$GITHUB_OUTPUT"
echo "cabal-version=$(cabal --numeric-version)" >> "$GITHUB_OUTPUT"
echo "cabal-store=$(cabal path -z --store-dir)" >> "$GITHUB_OUTPUT"
- name: Show the versions
id: versions
run: |
ghc --version
cabal --version
echo "GHC ${{ steps.setup.outputs.ghc-version }}, cabal ${{ steps.setup.outputs.cabal-version }}, image $ImageOS $ImageVersion" >> "$GITHUB_STEP_SUMMARY"
echo "image=$ImageOS" >> "$GITHUB_OUTPUT"
- name: Unpack the source tarballs
run: |
shopt -s extglob
cabal sdist all --output-directory="$RUNNER_TEMP"/haskell-gha-sdist
mkdir "$RUNNER_TEMP"/haskell-gha
for f in cabal.project cabal.project.freeze cabal.project.local; do
if [ -f "$f" ]; then cp "$f" "$RUNNER_TEMP"/haskell-gha; fi
done
tar -xzf "$RUNNER_TEMP"/haskell-gha-sdist/readme-+([0-9.]).tar.gz --strip-components=1 -C "$RUNNER_TEMP"/haskell-gha
- name: Configure the project
working-directory: ${{ runner.temp }}/haskell-gha
run: |
if [ -f cabal.project.local ]; then
echo '::error::The repository contains cabal.project.local, which holds the settings of one developer. Move the settings to cabal.project or to the key cabal-project-local of the configuration of haskell-gha, and remove the file from the repository.'
exit 1
fi
cat >> cabal.project.local <<'EOF'
jobs: 4
tests: True
benchmarks: True
write-ghc-environment-files: always
program-options
ghc-options: -Werror
EOF
- name: Prefer the oldest dependencies
if: matrix.dependencies == 'oldest'
working-directory: ${{ runner.temp }}/haskell-gha
run: |
echo 'prefer-oldest: True' >> cabal.project.local
- name: Enable parallel module builds for the local packages
if: contains(fromJSON('["9.6.7"]'), matrix.ghc)
working-directory: ${{ runner.temp }}/haskell-gha
run: |
cat >> cabal.project.local <<'EOF'
program-options
ghc-options: -j4
EOF
- name: Enable the GHC job semaphore or parallel module builds
if: contains(fromJSON('["9.10","9.12"]'), matrix.ghc)
working-directory: ${{ runner.temp }}/haskell-gha
run: |
if ghc --info | grep -F '("Semaphore version","2")' > /dev/null; then
echo 'GHC uses version 2 of the semaphore protocol and cabal version 1, so GHC uses -j4.'
cat >> cabal.project.local <<'EOF'
program-options
ghc-options: -j4
EOF
else
echo 'GHC and cabal use version 1 of the semaphore protocol, so GHC uses the semaphore.'
cat >> cabal.project.local <<'EOF'
semaphore: True
EOF
fi
- name: Make the build plan
id: plan
working-directory: ${{ runner.temp }}/haskell-gha
run: |
cabal build all --dry-run
echo "hash=$(sha256sum dist-newstyle/cache/plan.json | cut -d ' ' -f 1)" >> "$GITHUB_OUTPUT"
- uses: actions/cache/restore@v6
id: cache
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: haskell-gha.yaml-v1-${{ runner.os }}-${{ runner.arch }}-${{ steps.versions.outputs.image }}-ghc-${{ steps.setup.outputs.ghc-version }}-${{ matrix.dependencies }}-${{ steps.plan.outputs.hash }}
restore-keys: haskell-gha.yaml-v1-${{ runner.os }}-${{ runner.arch }}-${{ steps.versions.outputs.image }}-ghc-${{ steps.setup.outputs.ghc-version }}-${{ matrix.dependencies }}-
- name: Build the dependencies
working-directory: ${{ runner.temp }}/haskell-gha
run: |
cabal build all --only-dependencies
- uses: actions/cache/save@v6
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Find the doctest version
id: doctest
run: |
version=$(cabal --store-dir="$RUNNER_TEMP"/doctest-store install doctest --ignore-project --dry-run | sed -n 's/^ - doctest-\([0-9.]*\) (exe:doctest).*/\1/p')
if [ -z "$version" ]; then
echo 'The dry run of cabal install shows no doctest version.' >&2
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
- uses: actions/cache/restore@v6
id: doctest-cache
with:
path: ~/.local/bin/doctest
key: haskell-gha-v1-${{ runner.os }}-${{ runner.arch }}-${{ steps.versions.outputs.image }}-doctest-${{ steps.doctest.outputs.version }}-ghc-${{ steps.setup.outputs.ghc-version }}
- name: Install doctest
if: steps.doctest-cache.outputs.cache-hit != 'true'
run: |
cabal install doctest --ignore-project --install-method=copy --installdir="$HOME/.local/bin" --overwrite-policy=always --constraint='doctest ==${{ steps.doctest.outputs.version }}'
- uses: actions/cache/save@v6
if: steps.doctest-cache.outputs.cache-hit != 'true'
with:
path: ~/.local/bin/doctest
key: ${{ steps.doctest-cache.outputs.cache-primary-key }}
- name: Build
working-directory: ${{ runner.temp }}/haskell-gha
run: |
cabal build all
- name: Create the test database
run: psql -h localhost -U postgres -c 'CREATE DATABASE test'
env:
PGPASSWORD: postgres
- name: Run the tests
working-directory: ${{ runner.temp }}/haskell-gha
run: |
cabal test all --test-show-details=direct
- name: Run doctest for readme
working-directory: ${{ runner.temp }}/haskell-gha
run: |
"$HOME"/.local/bin/doctest -XGHC2021 src
- name: Check the packages
working-directory: ${{ runner.temp }}/haskell-gha
run: |
failed=0
check() {
echo "Checking the package $1"
(cd "$2" && cabal check) || { echo "::error::cabal check failed for the package $1"; failed=1; }
}
check readme .
exit "$failed"
- name: Build the documentation
working-directory: ${{ runner.temp }}/haskell-gha
run: |
cabal haddock all --disable-documentation --haddock-for-hackage