-
Notifications
You must be signed in to change notification settings - Fork 4
130 lines (127 loc) · 5.29 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# This GitHub Actions script was modified from from:
# <https://github.com/haskell/bytestring/blob/master/.github/workflows/ci.yml>
# (commit/bd3c32c784bde80c9a46b22ef0029e668c954e70) 2021-10-09
# with particular changes taken from <https://kodimensional.dev/github-actions>
# (which has still more stuff we may want to incorporate later).
#
# Once Haskell-CI fully supports generating GitHub Actions scripts,
# we should switch over to using that rather than maintaining this
# file manually.
name: ci
on:
push:
branches:
- master
pull_request: {}
defaults:
run:
shell: bash
jobs:
build:
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
# NOTE(2021-10-23): All these versions resolve to using the
# latest Cabal (>=3.4.0.0); they do *not* use the version
# of Cabal that originally shipped with the version of GHC.
# NOTE(2022-08-28): the newest release is ghc-9.4.2, but
# that's not on ubuntu-latest yet; and if something's not
# preinstalled, then haskell/actions/setup will use GHCup
# to install it but then (the script below) will also try
# to install it via apt-get which will fail.
os: [ubuntu-latest]
ghc: ['8.0.2', '8.2.2', '8.4.4', '8.6.5', '8.8.4', '8.10.3', '9.0.1', '9.2.4', '9.4.8', '9.6.5', '9.8.2', '9.10.1']
include:
# This package has no build details specific to Win/Mac,
# so building for the latest GHC should be sufficient
# (in conjunction with the full list above for Ubuntu).
- os: windows-latest
ghc: 'latest'
- os: macOS-latest
ghc: 'latest'
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/[email protected]
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
- name: Update cabal package database
run: cabal update
- name: Configure
# Generates the `cabal.project.local` file.
# We make sure to enable tests & benchmarks here so that when
# we run the tests/benchmarks they don't reconfigure things
# and thus cause rebuilding.
run: cabal configure --minimize-conflict-set --enable-tests --enable-benchmarks --test-show-details=direct
- name: Freeze
# Generates the `cabal.project.freeze` file.
run: cabal freeze
- uses: actions/[email protected]
name: Cache ~/.cabal/store and ./dist-newstyle
# TODO(2021-10-23): Do we really want the hash in the key?
# With nix-style builds it shouldn't be necessary (afaict),
# and so it reduces the likelihood of cache hits (albeit
# also reducing the footprint of the cache).
with:
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
- name: Install dependencies
run: cabal build all --only-dependencies
- name: Build
run: cabal build all
# TODO: why does bytestring run tests via sdist stuff instead
# of just directly? I could imagine it being a sanity check
# to ensure everything's included in the sdist tarball; but
# if that's the reason then shouldn't the build step above
# also be done there? (N.B., bytestring doesn't do the above
# step explicitly).
# Update(2021-10-23): Until I can figure out why they did it
# that way, I'm removing that part of the step in order to
# (a) simplify this script, and (b) avoid needing to say the
# package's name repeatedly.
# TODO(2021-10-23): The sdist-based testing approach also
# requires fiddling with the `cabal.project` file, apparently
# to deal with issues on Windows. Need we do that?
# TODO(2021-10-23): if we run into issues with Windows builds
# being flaky, then we should use Bytestring's hack of:
# ```
# bld() { cabal build .:tests; }
# bld || bld || bld
# ```
# to try building the tests a few times before admitting failure.
# <https://github.com/haskell/actions/issues/36>
- name: Test
run: cabal test all -j1
## BUG: Our benchmarks aren't hooked into cabal yet.
#- name: Bench
# run: cabal bench --benchmark-option=-l all
- name: Haddock
run: cabal haddock
# BUG (2021-10-23): Are our Tasty tests hooked into cabal enough to run this?
# TODO(2021-10-23): Should probably move to using Cirrus instead,
# since that's what bytestring does since:
# (commit/06cbef10f4869c6afdac210a22d9813b4f7f2fe6) 2021-06-10
#build-freebsd:
# # This job intentionally is using macOS because at the time of
# # the writing Linux and Windows environments don't have the
# # necessary virtualization features.
# # See <https://github.com/vmactions/freebsd-vm#under-the-hood>
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v4
# - name: Test
# id: build-freebsd
# uses: vmactions/[email protected]
# with:
# usesh: true
# mem: 4096
# prepare: pkg install -y ghc hs-cabal-install git
# # Virtual machine does not allow to leverage cache
# # and is quite slow, so only tests are run.
# run: |
# cabal update
# cabal test --test-show-details=direct