Skip to content

Commit

Permalink
GitHub Actions: include list of GHC versions in matrix
Browse files Browse the repository at this point in the history
Alongside "include" include the list of GHC versions in the matrix.
That is, instead of:

  matrix:
    include:
      - ghc: 8.10.3
        allow-failures: false
      - ghc: 8.8.4
        allow-failures: false

haskell-ci now produces:

  matrix:
    ghc:
      - 8.10.3
      - 8.8.4
    include:
      - ghc: 8.10.3
        allow-failures: false
      - ghc: 8.8.4
        allow-failures: false

This approach reduces the work required to introduce another
"dimension" into the matrix.  As a concrete example, the /notmuch/
library must be tested against various versions of libnotmuch.  With
the "ghc" version list defined, adding the list of notmuch versions
to test yields a matrix that is the cartesian product of the two (or
more) lists.  The "include" dicts correctly propagate the
"allow-failures" fields to corresponding matrix legs (evidence:
https://github.com/purebred-mua/hs-notmuch/actions/runs/466042178).
  • Loading branch information
frasertweedale committed Jan 7, 2021
1 parent a4ea1ed commit e834b14
Show file tree
Hide file tree
Showing 10 changed files with 265 additions and 1 deletion.
39 changes: 39 additions & 0 deletions fixtures/all-versions.github
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,45 @@ jobs:
continue-on-error: ${{ matrix.allow-failure }}
strategy:
matrix:
ghc:
- 8.10.3
- 8.10.2
- 8.10.1
- 8.8.4
- 8.8.3
- 8.8.2
- 8.8.1
- 8.6.5
- 8.6.4
- 8.6.3
- 8.6.2
- 8.6.1
- 8.4.4
- 8.4.3
- 8.4.2
- 8.4.1
- 8.2.2
- 8.2.1
- 8.0.2
- 8.0.1
- 7.10.3
- 7.10.2
- 7.10.1
- 7.8.4
- 7.8.3
- 7.8.2
- 7.8.1
- 7.6.3
- 7.6.2
- 7.6.1
- 7.4.2
- 7.4.1
- 7.2.2
- 7.2.1
- 7.0.4
- 7.0.3
- 7.0.2
- 7.0.1
include:
- ghc: 8.10.3
allow-failure: false
Expand Down
28 changes: 28 additions & 0 deletions fixtures/copy-fields-all.github
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,34 @@ jobs:
continue-on-error: ${{ matrix.allow-failure }}
strategy:
matrix:
ghc:
- 8.10.3
- 8.10.2
- 8.10.1
- 8.8.4
- 8.8.3
- 8.8.2
- 8.8.1
- 8.6.5
- 8.6.4
- 8.6.3
- 8.6.2
- 8.6.1
- 8.4.4
- 8.4.3
- 8.4.2
- 8.4.1
- 8.2.2
- 8.2.1
- 8.0.2
- 8.0.1
- 7.10.3
- 7.10.2
- 7.10.1
- 7.8.4
- 7.8.3
- 7.8.2
- 7.8.1
include:
- ghc: 8.10.3
allow-failure: false
Expand Down
28 changes: 28 additions & 0 deletions fixtures/copy-fields-none.github
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,34 @@ jobs:
continue-on-error: ${{ matrix.allow-failure }}
strategy:
matrix:
ghc:
- 8.10.3
- 8.10.2
- 8.10.1
- 8.8.4
- 8.8.3
- 8.8.2
- 8.8.1
- 8.6.5
- 8.6.4
- 8.6.3
- 8.6.2
- 8.6.1
- 8.4.4
- 8.4.3
- 8.4.2
- 8.4.1
- 8.2.2
- 8.2.1
- 8.0.2
- 8.0.1
- 7.10.3
- 7.10.2
- 7.10.1
- 7.8.4
- 7.8.3
- 7.8.2
- 7.8.1
include:
- ghc: 8.10.3
allow-failure: false
Expand Down
28 changes: 28 additions & 0 deletions fixtures/copy-fields-some.github
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,34 @@ jobs:
continue-on-error: ${{ matrix.allow-failure }}
strategy:
matrix:
ghc:
- 8.10.3
- 8.10.2
- 8.10.1
- 8.8.4
- 8.8.3
- 8.8.2
- 8.8.1
- 8.6.5
- 8.6.4
- 8.6.3
- 8.6.2
- 8.6.1
- 8.4.4
- 8.4.3
- 8.4.2
- 8.4.1
- 8.2.2
- 8.2.1
- 8.0.2
- 8.0.1
- 7.10.3
- 7.10.2
- 7.10.1
- 7.8.4
- 7.8.3
- 7.8.2
- 7.8.1
include:
- ghc: 8.10.3
allow-failure: false
Expand Down
28 changes: 28 additions & 0 deletions fixtures/empty-line.github
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,34 @@ jobs:
continue-on-error: ${{ matrix.allow-failure }}
strategy:
matrix:
ghc:
- 8.10.3
- 8.10.2
- 8.10.1
- 8.8.4
- 8.8.3
- 8.8.2
- 8.8.1
- 8.6.5
- 8.6.4
- 8.6.3
- 8.6.2
- 8.6.1
- 8.4.4
- 8.4.3
- 8.4.2
- 8.4.1
- 8.2.2
- 8.2.1
- 8.0.2
- 8.0.1
- 7.10.3
- 7.10.2
- 7.10.1
- 7.8.4
- 7.8.3
- 7.8.2
- 7.8.1
include:
- ghc: 8.10.3
allow-failure: false
Expand Down
28 changes: 28 additions & 0 deletions fixtures/irc-channels.github
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,34 @@ jobs:
continue-on-error: ${{ matrix.allow-failure }}
strategy:
matrix:
ghc:
- 8.10.3
- 8.10.2
- 8.10.1
- 8.8.4
- 8.8.3
- 8.8.2
- 8.8.1
- 8.6.5
- 8.6.4
- 8.6.3
- 8.6.2
- 8.6.1
- 8.4.4
- 8.4.3
- 8.4.2
- 8.4.1
- 8.2.2
- 8.2.1
- 8.0.2
- 8.0.1
- 7.10.3
- 7.10.2
- 7.10.1
- 7.8.4
- 7.8.3
- 7.8.2
- 7.8.1
include:
- ghc: 8.10.3
allow-failure: false
Expand Down
28 changes: 28 additions & 0 deletions fixtures/messy.github
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,34 @@ jobs:
continue-on-error: ${{ matrix.allow-failure }}
strategy:
matrix:
ghc:
- 8.10.3
- 8.10.2
- 8.10.1
- 8.8.4
- 8.8.3
- 8.8.2
- 8.8.1
- 8.6.5
- 8.6.4
- 8.6.3
- 8.6.2
- 8.6.1
- 8.4.4
- 8.4.3
- 8.4.2
- 8.4.1
- 8.2.2
- 8.2.1
- 8.0.2
- 8.0.1
- 7.10.3
- 7.10.2
- 7.10.1
- 7.8.4
- 7.8.3
- 7.8.2
- 7.8.1
include:
- ghc: 8.10.3
allow-failure: false
Expand Down
28 changes: 28 additions & 0 deletions fixtures/psql.github
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,34 @@ jobs:
continue-on-error: ${{ matrix.allow-failure }}
strategy:
matrix:
ghc:
- 8.10.3
- 8.10.2
- 8.10.1
- 8.8.4
- 8.8.3
- 8.8.2
- 8.8.1
- 8.6.5
- 8.6.4
- 8.6.3
- 8.6.2
- 8.6.1
- 8.4.4
- 8.4.3
- 8.4.2
- 8.4.1
- 8.2.2
- 8.2.1
- 8.0.2
- 8.0.1
- 7.10.3
- 7.10.2
- 7.10.1
- 7.8.4
- 7.8.3
- 7.8.2
- 7.8.1
include:
- ghc: 8.10.3
allow-failure: false
Expand Down
28 changes: 28 additions & 0 deletions fixtures/travis-patch.github
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,34 @@ jobs:
continue-on-error: ${{ matrix.allow-failure }}
strategy:
matrix:
ghc:
- 8.10.3
- 8.10.2
- 8.10.1
- 8.8.4
- 8.8.3
- 8.8.2
- 8.8.1
- 8.6.5
- 8.6.4
- 8.6.3
- 8.6.2
- 8.6.1
- 8.4.4
- 8.4.3
- 8.4.2
- 8.4.1
- 8.2.2
- 8.2.1
- 8.0.2
- 8.0.1
- 7.10.3
- 7.10.2
- 7.10.1
- 7.8.4
- 7.8.3
- 7.8.2
- 7.8.1
include:
- ghc: 8.10.3
allow-failure: false
Expand Down
3 changes: 2 additions & 1 deletion src/HaskellCI/GitHub/Yaml.hs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ instance ToYaml GitHubJob where
item $ "continue-on-error" ~> fromString continueOnError
item $ "strategy" ~> ykeyValuesFilt []
[ "matrix" ~> ykeyValuesFilt []
[ "include" ~> ylistFilt [] (map toYaml ghjMatrix)
[ "ghc" ~> ylistFilt [] (map (fromString . prettyShow . ghmeGhcVersion) ghjMatrix)
, "include" ~> ylistFilt [] (map toYaml ghjMatrix)
]
, "fail-fast" ~> YBool [] False
]
Expand Down

0 comments on commit e834b14

Please sign in to comment.