Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Merge the late additions to ghc-8.10 into ghc-9.0 #1296

Merged
merged 2 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
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
30 changes: 17 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: CI
on:
pull_request:
push:
branches: ["ghc-8.10"]
branches: ["ghc-9.0"]

jobs:
cabal:
Expand All @@ -13,37 +13,41 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
cabal: ["3.2"]
cabal: ["3.4"]
ghc:
- "8.10.1"
- "8.10.2"
- "9.0.1"

steps:
- uses: actions/checkout@v2
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/ghc-8.10'
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/ghc-9.0'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would go wrong without this line (i.e. if it is removed entirely)? cc @chshersh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing should go wrong. This is just an optimization. According to docs, possible events that trigger GitHub Actions include a lot of things, and by default CI is running a lot of times for different type events:

My understanding of this, is this is configured that way mostly because GitHub Actions can do a lot of things, not just build the code, but also review, add labels, write messages, etc. However, I usually only want to build on code changes for pull requests and commits to the main branches, and don't want to spend GitHub Actions resources on other events.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but doesn’t this if only apply to the checkout step? The other steps would run but without cloning the sources, and then fail

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Feel free to remove this line. I guess, nothing should become broken, and the config can be simplified.

I reread the documentation again, and it seems that the correct way to filter by events is something like this:


- uses: actions/setup-haskell@v1.1.4
- uses: haskell/actions/setup@v1
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}

- name: Prepare environment
run: echo "$HOME/.ghcup/bin" >> $GITHUB_PATH


- name: Freeze
run: |
cabal freeze

- uses: actions/cache@v1
name: Cache ~/.cabal/store
- uses: actions/cache@v2
name: Cache ~/.cabal/store and .ghcup
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
.ghcup
key: ${{ runner.os }}

- name: Build
run: |
cabal configure --enable-tests --enable-benchmarks --test-show-details=direct
cabal build all

- name: Test
run: |
cabal test all
run: cabal test all
24 changes: 5 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ Note: before building `haddock`, you need to build the subprojects
`haddock-library` and `haddock-api`, in this order!
The `cabal v2-build` takes care of this automatically.

#### Using [`cabal v2-build`][cabal v2]
#### Using `cabal`

Requires cabal `>= 3.4` and GHC `== 9.0`:

```bash
cabal v2-build -w ghc-8.10.1
cabal v2-test -w ghc-8.10.1 all
cabal build all --enable-tests
cabal test all
```

#### Using `stack`
Expand All @@ -57,22 +59,6 @@ export HADDOCK_PATH="$(stack exec which haddock)"
stack test
```

#### Using Cabal sandboxes (deprecated)

```bash
cabal sandbox init
cabal sandbox add-source haddock-library
cabal sandbox add-source haddock-api
cabal sandbox add-source haddock-test
# adjust -j to the number of cores you want to use
cabal install -j4 --dependencies-only --enable-tests
cabal configure --enable-tests
cabal build -j4
# run the test suite
export HADDOCK_PATH="dist/build/haddock/haddock"
cabal test
```

### Git Branches

If you're a GHC developer and want to update Haddock to work with your changes,
Expand Down
9 changes: 8 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@ packages: ./
./haddock-library
./haddock-test

with-compiler: ghc-9.0

allow-newer:
ghc-paths:Cabal,
*:base,
*:ghc-prim

-- Pinning the index-state helps to make reasonably CI deterministic
index-state: 2020-12-08T20:13:44Z
index-state: 2021-01-24T12:09:34Z
1 change: 1 addition & 0 deletions haddock-api/haddock-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ test-suite spec
, containers
, deepseq
, directory
, exceptions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous lack of CI shows! 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't say…
I'm really playing cat and mouse here :P

, filepath
, ghc-boot
, transformers
Expand Down