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 makes it possible to add another "dimension" to the
matrix using only `--github-patches`, by adding another list of
values.  As a concrete example, the *notmuch* library must be tested
against various versions of libnotmuch:

  matrix:
    notmuch: ["0.29.3", "0.30", "0.31.3", "git"]
    ghc:
      - 8.10.3
      - 8.8.4
    include:
      - ghc: 8.10.3
        allow-failures: false
      - ghc: 8.8.4
        allow-failures: false

The resulting matrix is the cartesian product of the values from the
"ghc" and other list(s).  The additional matrix line(s), and
corresponding build steps, can be introduced via --github-patch.

The "include" maps propagate the "allow-failures" field to the
matrix legs with matching "ghc" version (evidence:
https://github.com/purebred-mua/hs-notmuch/actions/runs/466042178).
  • Loading branch information
frasertweedale committed Jan 7, 2021
1 parent a4ea1ed commit 2ca63c4
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 2ca63c4

Please sign in to comment.