From 2fa0929531d8584e06dc08202231d6d5638cda0b Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Thu, 24 Sep 2026 02:08:18 +0200 Subject: [PATCH] Generate the CI workflow with haskell-gha The workflow was written by hand. Now haskell-gha generates it, and a hook runs the same check of the tags of this repository. The new workflow also builds the source tarball, runs cabal check and builds the documentation. The tested-with field now lists each GHC series instead of exact versions, so each job uses the newest release of its series. The package description also no longer gives warnings in cabal check, apart from the missing upper bounds. --- .github/haskell-gha.conf.yml | 4 + .github/workflows/ci.yml | 52 ------------ .github/workflows/haskell-gha.yml | 128 ++++++++++++++++++++++++++++++ README.md | 2 +- ghc-tags.cabal | 4 +- 5 files changed, 135 insertions(+), 55 deletions(-) create mode 100644 .github/haskell-gha.conf.yml delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/haskell-gha.yml diff --git a/.github/haskell-gha.conf.yml b/.github/haskell-gha.conf.yml new file mode 100644 index 0000000..f6b383d --- /dev/null +++ b/.github/haskell-gha.conf.yml @@ -0,0 +1,4 @@ +hooks: + after-build: + - name: Generate tags for this repository + run: ./scripts/check-tags.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 412ac25..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: CI - -on: - push: - branches: - - master - pull_request: - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - name: GHC ${{ matrix.ghc }} - runs-on: ubuntu-26.04 - strategy: - fail-fast: false - matrix: - ghc: - - '9.10.3' - - '9.12.4' - - '9.14.1' - steps: - - uses: actions/checkout@v7 - - - uses: haskell-actions/setup@v2 - id: setup - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: '3.16.1.0' - - - name: Configure the project - run: | - cat >> cabal.project.local <> "$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/ghc-tags-+([0-9.]).tar.gz --strip-components=1 -C "$RUNNER_TEMP"/haskell-gha + + - name: Configure the project + working-directory: ${{ runner.temp }}/haskell-gha + run: | + cat >> cabal.project.local <<'EOF' + jobs: 4 + tests: True + benchmarks: True + + package ghc-tags + ghc-options: -Werror + EOF + + - name: Enable the GHC job semaphore + working-directory: ${{ runner.temp }}/haskell-gha + run: | + echo 'semaphore: True' >> cabal.project.local + + - 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: ${{ runner.os }}-${{ steps.versions.outputs.image }}-ghc-${{ steps.setup.outputs.ghc-version }}-${{ steps.plan.outputs.hash }} + restore-keys: ${{ runner.os }}-${{ steps.versions.outputs.image }}-ghc-${{ steps.setup.outputs.ghc-version }}- + + - 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: Build + working-directory: ${{ runner.temp }}/haskell-gha + run: | + cabal build all + + - name: Generate tags for this repository + run: ./scripts/check-tags.sh + + - name: Check the packages + working-directory: ${{ runner.temp }}/haskell-gha + run: | + cabal check + + - name: Build the documentation + working-directory: ${{ runner.temp }}/haskell-gha + run: | + cabal haddock all --disable-documentation --haddock-all --haddock-for-hackage diff --git a/README.md b/README.md index df77005..724b524 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ghc-tags -[![Build Status](https://github.com/arybczak/ghc-tags/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/arybczak/ghc-tags/actions?query=branch%3Amaster) +[![Build Status](https://github.com/arybczak/ghc-tags/actions/workflows/haskell-gha.yml/badge.svg?branch=master)](https://github.com/arybczak/ghc-tags/actions?query=branch%3Amaster) [![Hackage](https://img.shields.io/hackage/v/ghc-tags.svg)](https://hackage.haskell.org/package/ghc-tags) A command line tool that generates etags diff --git a/ghc-tags.cabal b/ghc-tags.cabal index 3706b4e..a335910 100644 --- a/ghc-tags.cabal +++ b/ghc-tags.cabal @@ -10,11 +10,11 @@ author: Andrzej Rybczak maintainer: andrzej@rybczak.net copyright: Andrzej Rybczak category: Development -extra-source-files: CHANGELOG.md +extra-doc-files: CHANGELOG.md README.md homepage: https://github.com/arybczak/ghc-tags bug-reports: https://github.com/arybczak/ghc-tags/issues -tested-with: GHC == { 9.10.3, 9.12.4, 9.14.1 } +tested-with: GHC ^>= { 9.10, 9.12, 9.14 } source-repository head type: git