Skip to content

Commit

Permalink
Simplify CI workflow to standard haskell-ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sgraf812 committed Jul 22, 2024
1 parent fa06571 commit a1a9f87
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 62 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ jobs:
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
HCDIR=/opt/$HCKIND/$HCVER
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
echo "$HOME/.ghcup/bin" >> "$GITHUB_PATH"
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
echo "HC=$HC" >> "$GITHUB_ENV"
Expand Down Expand Up @@ -263,9 +262,7 @@ jobs:
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
- name: tests
run: |
export HAPPY=$HOME/.cabal/bin/happy
export HC
export CABAL
export CABAL HC
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
- name: cabal check
run: |
Expand Down
52 changes: 2 additions & 50 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,9 @@ This document holds some useful information for developing Happy.
CI on GitHub Actions
====================

2021-07-14
2024-07-15
----------

The GHC workflow file `.github/workflows/haskell-ci.yml` is generated by:

haskell-ci regenerate
patch --input=.github/haskell-ci.patch .github/workflows/haskell-ci.yml

The patch introduces happy specifics to the build and test process that
are not covered by a vanilla instance of the haskell-ci workflow.

When new GHC versions become available, CI can be updated by

- adding these versions to the `tested-with` field in `happy.cabal`
(possibly removing obsolete minor versions)

- generate the `haskell-ci.yml` by the steps above.

This should work as long as `haskell-ci` does not change its generated
workflow too much. Otherwise, the patch might not apply cleanly and
the workflow has to be patched manually.

2023-02-06 Updating to a new version of Haskell-CI
--------------------------------------------------

1. Install Haskell-CI from its source repo:

pushd /tmp
git clone https://github.com/haskell-CI/haskell-ci.git
cd haskell-ci
cabal install
popd

2. Update the `tested-with` fields in the `.cabal` files.

3. Follow the instructions to regenerate the Haskell CI workflow, which are:

haskell-ci regenerate
patch --input=.github/haskell-ci.patch .github/workflows/haskell-ci.yml

If some hunks fail to apply in the last step, the patch as to be updated.

4. Apply the remaining hunks manually.

5. Save the patched workflow, regenerate the original workflow, regenerate the patch

cp .github/workflows/haskell-ci.yml .github/workflows/haskell-ci.yml-patched
haskell-ci regenerate
diff -u .github/workflows/haskell-ci.yml .github/workflows/haskell-ci.yml-patched > .github/haskell-ci.patch

6. Now the patch will apply cleanly.

patch --input=.github/haskell-ci.patch .github/workflows/haskell-ci.yml

7. Commit the updated files (no extra files need to be committed).
4 changes: 2 additions & 2 deletions happy.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ stability: stable
homepage: https://www.haskell.org/happy/
synopsis: Happy is a parser generator for Haskell
category: Development
cabal-version: >= 1.10
cabal-version: >= 2.0
build-type: Simple

Description:
Expand Down Expand Up @@ -161,7 +161,7 @@ test-suite tests
type: exitcode-stdio-1.0
main-is: test.hs
-- This line is important as it ensures that the local `exe:happy` component declared above is built before the test-suite component is invoked, as well as making sure that `happy` is made available on $PATH and `$happy_datadir` is set accordingly before invoking `test.hs`
build-tools: happy
build-tool-depends: happy:happy
ghc-options: -threaded

build-depends: base < 5, process < 1.7
Expand Down
7 changes: 1 addition & 6 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@
# without danger of it being "fixed" by the logic below.
# [2021-07-14, PR #196](https://github.com/haskell/happy/pull/196)
#
ifndef HAPPY
HAPPY=$(shell which happy)
ifeq "$(filter $(dir $(shell pwd))%,$(HAPPY))" ""
HAPPY=../dist/build/happy/happy
endif
endif
HAPPY ?= $(CABAL) -v0 exec happy --

# NOTE: This assumes that a working `ghc` is on $PATH; this may not
# necessarily be the same GHC used by `cabal` for building `happy`.
Expand Down

0 comments on commit a1a9f87

Please sign in to comment.