Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github Actions update from https://github.com/bellroy/gha-workflows/pull/547 #36

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 61 additions & 52 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
name: Haskell CI
on:
- push
# This file is generated by `generate.sh`.
# Generated from https://github.com/bellroy/gha-workflows/tree/master/dhall/workflows/wai-handler-hal/haskell-ci.dhall
# Think twice before editing it directly.
jobs:
generate-matrix:
name: "Generate matrix from cabal"
name: Generate matrix from cabal
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
matrix: "${{ steps.set-matrix.outputs.matrix }}"
runs-on: ubuntu-20.04
steps:
- name: Extract the tested GHC versions
id: set-matrix
uses: kleidukos/get-tested@a0aa3f2d4ab0d10daa49dc9ee8c706d673fb0e02
- id: set-matrix
name: Extract the tested GHC versions
uses: "kleidukos/get-tested@a0aa3f2d4ab0d10daa49dc9ee8c706d673fb0e02"
with:
cabal-file: wai-handler-hal.cabal
ubuntu-version: "20.04"
version: 0.1.7.1
ubuntu-version: '20.04'
version: '0.1.7.1'
timeout-minutes: 30
tests:
name: ${{ matrix.ghc }} on ${{ matrix.os }}
needs: generate-matrix
runs-on: ${{ matrix.os }}
container:
image: buildpack-deps:jammy
strategy:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
name: "${{ matrix.ghc }} on ${{ matrix.os }}"
needs:
- generate-matrix
runs-on: "${{ matrix.os }}"
steps:
- name: apt
- env:
HCKIND: ghc
HCNAME: "ghc-${{ matrix.ghc }}"
HCVER: "${{ matrix.ghc }}"
name: apt
run: |
apt-get update
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
Expand All @@ -33,11 +37,11 @@ jobs:
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
env:
- env:
HCKIND: ghc
HCNAME: ghc-${{ matrix.ghc }}
HCVER: ${{ matrix.ghc }}
- name: Set PATH and environment variables
HCNAME: "ghc-${{ matrix.ghc }}"
HCVER: "${{ matrix.ghc }}"
name: Set PATH and environment variables
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
Expand All @@ -58,13 +62,8 @@ jobs:
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
echo "GHCJSARITH=0" >> "$GITHUB_ENV"
env:
HCKIND: ghc
HCNAME: ghc-${{ matrix.ghc }}
HCVER: ${{ matrix.ghc }}
- name: env
run: |
env
run: env
- name: write cabal config
run: |
mkdir -p $CABAL_DIR
Expand Down Expand Up @@ -95,13 +94,12 @@ jobs:
$HC --print-project-git-commit-id || true
$CABAL --version || true
- name: update cabal index
run: |
$CABAL v2-update -v
- name: cache (tools)
uses: actions/cache/restore@v4
run: "$CABAL v2-update -v"
- name: "cache (tools)"
uses: "actions/cache/restore@v4"
with:
key: ${{ runner.os }}-${{ matrix.ghc }}-tools-ac1dc7e1
path: ~/.haskell-ci-tools
key: "${{ runner.os }}-${{ matrix.ghc }}-tools-ac1dc7e1"
path: "~/.haskell-ci-tools"
- name: install cabal-plan
run: |
mkdir -p $HOME/.cabal/bin
Expand All @@ -115,14 +113,14 @@ jobs:
run: |
$CABAL --store-dir=$HOME/.haskell-ci-tools/store v2-install $ARG_COMPILER --ignore-project -j2 doctest --constraint='doctest ^>=0.22.0'
doctest --version
- name: save cache (tools)
uses: actions/cache/save@v4
if: always()
- if: "always()"
name: "save cache (tools)"
uses: "actions/cache/save@v4"
with:
key: ${{ runner.os }}-${{ matrix.ghc }}-tools-ac1dc7e1
path: ~/.haskell-ci-tools
key: "${{ runner.os }}-${{ matrix.ghc }}-tools-ac1dc7e1"
path: "~/.haskell-ci-tools"
- name: checkout
uses: actions/checkout@v4
uses: "actions/checkout@v4"
with:
path: source
- name: initial cabal.project for sdist
Expand All @@ -140,12 +138,12 @@ jobs:
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
- name: generate cabal.project
run: |
PKGDIR_wai_handler_hal="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/wai-handler-hal-[0-9.]*')"
echo "PKGDIR_wai_handler_hal=${PKGDIR_wai_handler_hal}" >> "$GITHUB_ENV"
PKGDIR_PROJECT="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/wai-handler-hal-[0-9.]*')"
echo "PKGDIR_PROJECT=${PKGDIR_PROJECT}" >> "$GITHUB_ENV"
rm -f cabal.project cabal.project.local
touch cabal.project
touch cabal.project.local
echo "packages: ${PKGDIR_wai_handler_hal}" >> cabal.project
echo "packages: ${PKGDIR_PROJECT}" >> cabal.project
echo "package wai-handler-hal" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
cat >> cabal.project <<EOF
Expand All @@ -158,11 +156,11 @@ jobs:
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
cabal-plan
- name: restore cache
uses: actions/cache/restore@v4
uses: "actions/cache/restore@v4"
with:
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
path: ~/.cabal/store
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
key: "${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}"
path: "~/.cabal/store"
restore-keys: "${{ runner.os }}-${{ matrix.ghc }}-"
- name: install dependencies
run: |
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
Expand All @@ -178,11 +176,11 @@ jobs:
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
- name: doctest
run: |
cd ${PKGDIR_wai_handler_hal} || false
cd ${PKGDIR_PROJECT} || false
doctest -XHaskell2010 src
- name: cabal check
run: |
cd ${PKGDIR_wai_handler_hal} || false
cd ${PKGDIR_PROJECT} || false
${CABAL} -vnormal check
- name: haddock
run: |
Expand All @@ -191,9 +189,20 @@ jobs:
run: |
rm -f cabal.project.local
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
- name: save cache
uses: actions/cache/save@v4
if: always()
- if: "always()"
name: save cache
uses: "actions/cache/save@v4"
with:
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
path: ~/.cabal/store
key: "${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}"
path: "~/.cabal/store"
strategy:
matrix:
include:
- "${{ (fromJSON(needs.generate-matrix.outputs.matrix)).include }}"
timeout-minutes: 30
name: Haskell CI
on:
push:
branches-ignore:
- "refs/tags/*_staging"
- "refs/tags/*_production"