Skip to content

Commit

Permalink
Experiment with loading matrix values from a file (#3481)
Browse files Browse the repository at this point in the history
* Experiment with loading matrix values from a file

The goal here is to avoid duplication of e.g. which versions of GHC we
support.

This is an experiment at the moment.

* fix some warnings in hlint plugin
  • Loading branch information
michaelpj authored Feb 13, 2023
1 parent d3a5ee1 commit efbf253
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 51 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ jobs:
strategy:
fail-fast: false
matrix:
ghc: ['8.10.7', '9.2.5']
os: [ubuntu-latest]
ghc:
- '8.10.7'
- '9.2.5'
os:
- ubuntu-latest

# This code is fitted to the strategy: assumes Linux is used ... etc,
# change of the strategy may require changing the bootstrapping/run code
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/caching.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@ jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
ghcs: ${{ steps.ghcs.outputs.ghcs }}
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
# Need the repo checked out in order to read the file
- uses: actions/checkout@v3
- id: ghcs
run: echo "ghcs=$(cat ./.github/workflows/supported-ghc-versions.json)" >> $GITHUB_OUTPUT
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5.3.0
with:
Expand All @@ -80,17 +85,11 @@ jobs:
strategy:
fail-fast: false
matrix:
# This list of GHC (including the "exclude" list) versions must match
# to the list of GHC versions specified in 'test.yml'
ghc: [ "9.4.4"
, "9.2.5"
, "9.0.2"
, "8.10.7"
]
os: [ "ubuntu-latest"
, "macOS-latest"
, "windows-latest"
]
ghc: ${{ fromJSON(needs.pre_job.outputs.ghcs) }}
os:
- ubuntu-latest
- macOS-latest
- windows-latest
steps:
- uses: actions/checkout@v3

Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/flags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
ghcs: ${{ steps.ghcs.outputs.ghcs }}
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
# Need the repo checked out in order to read the file
- uses: actions/checkout@v3
- id: ghcs
run: echo "ghcs=$(cat ./.github/workflows/supported-ghc-versions.json)" >> $GITHUB_OUTPUT
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5.3.0
with:
Expand All @@ -44,12 +49,9 @@ jobs:
strategy:
fail-fast: true
matrix:
ghc: [ "9.2.5"
, "9.0.2"
, "8.10.7"
]
os: [ "ubuntu-latest"
]
ghc: ${{ fromJSON(needs.pre_job.outputs.ghcs) }}
os:
- ubuntu-latest

steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/supported-ghc-versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ "9.4.4" , "9.2.5" , "9.0.2" , "8.10.7" ]
46 changes: 14 additions & 32 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ jobs:
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
should_skip_ghcide: ${{ steps.skip_ghcide_check.outputs.should_skip }}
ghcs: ${{ steps.ghcs.outputs.ghcs }}
steps:
# Need the repo checked out in order to read the file
- uses: actions/checkout@v3
- id: ghcs
run: echo "ghcs=$(cat ./.github/workflows/supported-ghc-versions.json)" >> $GITHUB_OUTPUT
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5.3.0
with:
Expand Down Expand Up @@ -52,49 +57,26 @@ jobs:

test:
if: needs.pre_job.outputs.should_skip != 'true'
needs: pre_job
needs:
- pre_job
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
# when you edit this list of GHC versions,
# **don't forget**
# to update the ghc versions in 'caching.yml'.
matrix:
ghc: [ "9.4.4"
, "9.2.5"
, "9.0.2"
, "8.10.7"
]
os: [ "ubuntu-latest"
, "macOS-latest"
, "windows-latest"
]
# Mark which GHC versions on which platform we want to test.
ghc: ${{ fromJSON(needs.pre_job.outputs.ghcs) }}
os:
- ubuntu-latest
- macOS-latest
- windows-latest
# Mark which GHC versions on which platforms we want to test.
include:
# only test supported ghc major versions
- os: ubuntu-latest
ghc: '9.4.4'
test: true
- os: ubuntu-latest
ghc: '9.2.5'
test: true
- os: ubuntu-latest
ghc: '9.0.2'
test: true
# Test all supported versions, but only on ubuntu and windows
- os: ubuntu-latest
ghc: '8.10.7'
test: true
- os: windows-latest
ghc: '9.4.4'
test: true
- os: windows-latest
ghc: '9.2.5'
test: true
- os: windows-latest
ghc: '9.0.2'
test: true
- os: windows-latest
ghc: '8.10.7'
test: true

steps:
Expand Down
8 changes: 8 additions & 0 deletions plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@

{-# OPTIONS_GHC -Wno-orphans #-}

-- On 9.4 we get a new redundant constraint warning, but deleting the
-- constraint breaks the build on earlier versions. Rather than apply
-- lots of CPP, we just disable the warning until later.
{-# OPTIONS_GHC -Wno-redundant-constraints #-}

#ifdef HLINT_ON_GHC_LIB
#define MIN_GHC_API_VERSION(x,y,z) MIN_VERSION_ghc_lib_parser(x,y,z)
#else
Expand Down Expand Up @@ -134,8 +139,11 @@ import Development.IDE.Spans.Pragmas (LineSplitTe
lineSplitTextEdits,
nextPragmaLine)
import GHC.Generics (Generic)
#if MIN_VERSION_apply_refact(0,12,0)
#else
import System.Environment (setEnv,
unsetEnv)
#endif
import Text.Regex.TDFA.Text ()
-- ---------------------------------------------------------------------

Expand Down

0 comments on commit efbf253

Please # to comment.