From e834b148c1c6e7904cd60dd871c0dff625ccb8f5 Mon Sep 17 00:00:00 2001 From: Fraser Tweedale Date: Wed, 6 Jan 2021 22:19:58 +1000 Subject: [PATCH] GitHub Actions: include list of GHC versions in matrix 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). --- fixtures/all-versions.github | 39 ++++++++++++++++++++++++++++++++ fixtures/copy-fields-all.github | 28 +++++++++++++++++++++++ fixtures/copy-fields-none.github | 28 +++++++++++++++++++++++ fixtures/copy-fields-some.github | 28 +++++++++++++++++++++++ fixtures/empty-line.github | 28 +++++++++++++++++++++++ fixtures/irc-channels.github | 28 +++++++++++++++++++++++ fixtures/messy.github | 28 +++++++++++++++++++++++ fixtures/psql.github | 28 +++++++++++++++++++++++ fixtures/travis-patch.github | 28 +++++++++++++++++++++++ src/HaskellCI/GitHub/Yaml.hs | 3 ++- 10 files changed, 265 insertions(+), 1 deletion(-) diff --git a/fixtures/all-versions.github b/fixtures/all-versions.github index 28eec0cb..ba8e3b48 100644 --- a/fixtures/all-versions.github +++ b/fixtures/all-versions.github @@ -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 diff --git a/fixtures/copy-fields-all.github b/fixtures/copy-fields-all.github index 4770b2ec..fd12c16d 100644 --- a/fixtures/copy-fields-all.github +++ b/fixtures/copy-fields-all.github @@ -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 diff --git a/fixtures/copy-fields-none.github b/fixtures/copy-fields-none.github index 69fc602b..b972ffd1 100644 --- a/fixtures/copy-fields-none.github +++ b/fixtures/copy-fields-none.github @@ -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 diff --git a/fixtures/copy-fields-some.github b/fixtures/copy-fields-some.github index 3eb52d26..2aee2ee7 100644 --- a/fixtures/copy-fields-some.github +++ b/fixtures/copy-fields-some.github @@ -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 diff --git a/fixtures/empty-line.github b/fixtures/empty-line.github index 1792eea0..88fedb84 100644 --- a/fixtures/empty-line.github +++ b/fixtures/empty-line.github @@ -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 diff --git a/fixtures/irc-channels.github b/fixtures/irc-channels.github index aaf84b1e..9b1bdb61 100644 --- a/fixtures/irc-channels.github +++ b/fixtures/irc-channels.github @@ -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 diff --git a/fixtures/messy.github b/fixtures/messy.github index 0701c7b5..432a72ef 100644 --- a/fixtures/messy.github +++ b/fixtures/messy.github @@ -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 diff --git a/fixtures/psql.github b/fixtures/psql.github index ef2f4693..75a080ad 100644 --- a/fixtures/psql.github +++ b/fixtures/psql.github @@ -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 diff --git a/fixtures/travis-patch.github b/fixtures/travis-patch.github index c87c0fa4..3bc9e16f 100644 --- a/fixtures/travis-patch.github +++ b/fixtures/travis-patch.github @@ -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 diff --git a/src/HaskellCI/GitHub/Yaml.hs b/src/HaskellCI/GitHub/Yaml.hs index 9d1f2bc1..dcda7007 100644 --- a/src/HaskellCI/GitHub/Yaml.hs +++ b/src/HaskellCI/GitHub/Yaml.hs @@ -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 ]