Files
pandoc/.github/workflows/ci.yml
T
John MacFarlaneandClaude Opus 5.5 e44a2f3d05 CI: use cabal update -z.
Without -z, cabal update clones source-repository-packages into
dist-newstyle. Restoring an older dist-newstyle cache on top of
that fresh shallow clone corrupts it ("Could not read <commit>"),
which broke the Windows and Linux 9.14 jobs after the citeproc
tag changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 12:55:19 -07:00

215 lines
6.5 KiB
YAML

name: CI tests
on:
push:
branches:
- 'main'
paths-ignore:
- 'doc/*.md'
- 'MANUAL.txt'
- '*.md'
- '.cirrus.yml'
- 'RELEASE-CHECKLIST-TEMPLATE.org'
- 'release-announcements.txt'
- 'BUGS'
- 'README.template'
- 'hie.yaml'
- '*.nix'
- 'tools/**'
- 'linux/**'
- 'macos/**'
- 'windows/**'
- 'man/**'
pull_request:
paths-ignore:
- 'doc/*.md'
- 'MANUAL.txt'
- '*.md'
- 'RELEASE-CHECKLIST-TEMPLATE.org'
- 'release-announcements.txt'
- 'BUGS'
- 'README.template'
- 'hie.yaml'
- '*.nix'
- 'tools/**'
- 'linux/**'
- 'macos/**'
- 'windows/**'
- 'man/**'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
versions:
# NOTE: Update `CONTRIBUTING.md` when changing the minimum version
- ghc: '9.6'
cabal: 'latest'
cabalopts: '--ghc-option=-Werror'
- ghc: '9.8'
cabal: 'latest'
cabalopts: '--ghc-option=-Werror'
- ghc: '9.10'
cabal: 'latest'
cabalopts: '--ghc-option=-Werror'
- ghc: '9.12'
cabal: 'latest'
cabalopts: '--ghc-option=-Werror'
- ghc: '9.12'
cabal: 'latest'
cabalopts: '--ghc-option=-Werror -f-embed_data_files'
- ghc: '9.14'
cabal: 'latest'
cabalopts: '--ghc-option=-Werror'
steps:
- uses: actions/checkout@v7
- name: Workaround runner image issue
# https://github.com/actions/runner-images/issues/7061
run: sudo chown -R $USER /usr/local/.ghcup
- name: Install cabal/ghc
run: |
ghcup install ghc --set ${{ matrix.versions.ghc }}
ghcup install cabal --set ${{ matrix.versions.cabal }}
# declare/restore cached things
# cabal update also writes a default config file if there is none;
# without one, cabal path prints a notice on stdout. -z (ignore the
# project) keeps cabal path from checking out source-repository-packages,
# which prints git output on stdout too. cabal update needs -z as well:
# otherwise it clones source-repository-packages into dist-newstyle,
# and restoring the dist-newstyle cache on top of that clone corrupts it.
- name: Update cabal and get store path
id: cabal-store
run: |
cabal update -z
echo "dir=$(cabal path -z --store-dir)" >> "$GITHUB_OUTPUT"
- name: Cache cabal global package db
id: cabal-global
uses: actions/cache@v6
with:
path: |
${{ steps.cabal-store.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.versions.ghc }}-${{ matrix.versions.cabal }}-cabal-global-${{ secrets.CACHE_VERSION }}-${{ hashFiles('cabal.project', '**/*.cabal') }}
restore-keys: |
${{ runner.os }}-${{ matrix.versions.ghc }}-${{ matrix.versions.cabal }}-cabal-global-${{ secrets.CACHE_VERSION }}-
- name: Cache cabal work
id: cabal-local
uses: actions/cache@v6
with:
path: |
dist-newstyle
key: ${{ runner.os }}-${{ strategy.job-index }}-${{ matrix.versions.ghc }}-${{ matrix.versions.cabal }}-cabal-local-${{ secrets.CACHE_VERSION }}-${{ hashFiles('cabal.project', '**/*.cabal') }}
restore-keys: |
${{ runner.os }}-${{ strategy.job-index }}-${{ matrix.versions.ghc }}-${{ matrix.versions.cabal }}-cabal-local-${{ secrets.CACHE_VERSION }}-
- name: Build and test
run: |
cabal build ${{ matrix.versions.cabalopts }} --enable-tests --disable-optimization all
cabal test ${{ matrix.versions.cabalopts }} --disable-optimization all
linux-stack:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v7
# needed by memory
- name: Install numa
run: sudo apt-get update && sudo apt-get install libnuma-dev
# declare/restore cached things
- name: Cache stack global package db
id: stack-global
uses: actions/cache@v6
with:
path: |
~/.stack
key: ${{ runner.os }}-stack-global-${{ secrets.CACHE_VERSION }}-${{ hashFiles('stack.yaml', '**/*.cabal') }}
restore-keys: |
${{ runner.os }}-stack-global-${{ secrets.CACHE_VERSION }}-
- name: Cache stack work
id: stack-local
uses: actions/cache@v6
with:
path: |
.stack-work
key: ${{ runner.os }}-stack-local-${{ secrets.CACHE_VERSION }}-${{ hashFiles('stack.yaml', '**/*.cabal') }}
restore-keys: |
${{ runner.os }}-stack-local-${{ secrets.CACHE_VERSION }}-
- name: Build and test
run: |
stack test --fast
windows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v7
- name: Install ghc
run: |
ghcup install ghc --set 9.10
ghcup install cabal --set latest
# declare/restore cached things
# cabal update also writes a default config file if there is none;
# without one, cabal path prints a notice on stdout. -z (ignore the
# project) keeps cabal path from checking out source-repository-packages,
# which prints git output on stdout too. cabal update needs -z as well:
# otherwise it clones source-repository-packages into dist-newstyle,
# and restoring the dist-newstyle cache on top of that clone corrupts it.
- name: Update cabal and get store path
id: cabal-store
shell: bash
run: |
cabal update -z
echo "dir=$(cabal path -z --store-dir)" >> "$GITHUB_OUTPUT"
- name: Cache cabal global package db
id: cabal-global
uses: actions/cache@v6
with:
path: |
${{ steps.cabal-store.outputs.dir }}
key: ${{ runner.os }}-appdata-cabal-${{ secrets.CACHE_VERSION }}-${{ hashFiles('cabal.project', '**/*.cabal') }}
restore-keys: |
${{ runner.os }}-appdata-cabal-${{ secrets.CACHE_VERSION }}-
- name: Cache cabal work
id: cabal-local
uses: actions/cache@v6
with:
path: |
dist-newstyle
key: ${{ runner.os }}-cabal-work-${{ secrets.CACHE_VERSION }}-${{ hashFiles('cabal.project', '**/*.cabal') }}
restore-keys: |
${{ runner.os }}-cabal-work-${{ secrets.CACHE_VERSION }}-
- name: Build and test
run: |
cabal test --ghc-option=-Werror -fhttp --enable-tests --disable-optimization all