Skip to content

Commit

Permalink
Merge pull request #150 from haskell/lehins/ci-fixes
Browse files Browse the repository at this point in the history
CI fixes
  • Loading branch information
lehins authored Oct 28, 2023
2 parents 74a0991 + 425ca9a commit 7ada644
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 80 deletions.
103 changes: 56 additions & 47 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:

defaults: { run: { shell: bash } }

# Cancel running actions when a new action on the same PR is started
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build-cabal:
name: CI-cabal
Expand All @@ -24,9 +29,10 @@ jobs:
- { os: ubuntu-latest, ghc: "8.8.4" }
- { os: ubuntu-latest, ghc: "8.10.7" }
- { os: ubuntu-latest, ghc: "9.0.2" }
- { os: ubuntu-latest, ghc: "9.2.7" }
- { os: ubuntu-latest, ghc: "9.4.4" }
- { os: ubuntu-latest, ghc: "9.6.1" }
- { os: ubuntu-latest, ghc: "9.2.8" }
- { os: ubuntu-latest, ghc: "9.4.7" }
- { os: ubuntu-latest, ghc: "9.6.3" }
- { os: ubuntu-latest, ghc: "9.8.1" }
# MacOS
- { os: macOS-latest, ghc: "8.0.2" }
- { os: macOS-latest, ghc: "8.2.2" }
Expand All @@ -35,9 +41,10 @@ jobs:
- { os: macOS-latest, ghc: "8.8.4" }
- { os: macOS-latest, ghc: "8.10.7" }
- { os: macOS-latest, ghc: "9.0.2" }
- { os: macOS-latest, ghc: "9.2.7" }
- { os: macOS-latest, ghc: "9.4.4" }
- { os: macOS-latest, ghc: "9.6.1" }
- { os: macOS-latest, ghc: "9.2.8" }
- { os: macOS-latest, ghc: "9.4.7" }
- { os: macOS-latest, ghc: "9.6.3" }
- { os: macOS-latest, ghc: "9.8.1" }
# Windows
- { os: windows-latest, ghc: "8.0.2" }
- { os: windows-latest, ghc: "8.2.2" }
Expand All @@ -46,13 +53,14 @@ jobs:
- { os: windows-latest, ghc: "8.8.4" }
- { os: windows-latest, ghc: "8.10.7" }
- { os: windows-latest, ghc: "9.0.2" }
- { os: windows-latest, ghc: "9.2.7" }
- { os: windows-latest, ghc: "9.4.4" }
- { os: windows-latest, ghc: "9.6.1" }
- { os: windows-latest, ghc: "9.2.8" }
- { os: windows-latest, ghc: "9.4.7" }
- { os: windows-latest, ghc: "9.6.3" }
- { os: windows-latest, ghc: "9.8.1" }
steps:
- uses: actions/checkout@v3

- uses: haskell/actions/setup@v2
- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
name: Setup Haskell
with:
Expand Down Expand Up @@ -84,46 +92,52 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
resolver: [nightly, lts-20, lts-19, lts-18, lts-16, lts-14, lts-12, lts-11]
resolver: [nightly, lts-21, lts-20, lts-19, lts-18, lts-16, lts-14, lts-12, lts-11]
include:
- resolver: lts-11
ghc: 8.2.2
ghc: '8.2.2'
stack-yaml: stack-old.yaml
- resolver: lts-12
ghc: 8.4.4
ghc: '8.4.4'
stack-yaml: stack-old.yaml
- resolver: lts-14
stack-yaml: stack-coveralls.yaml
ghc: '8.6.5'
stack-yaml: stack-old.yaml
- resolver: lts-16
ghc: 8.8.4
ghc: '8.8.4'
stack-yaml: stack-old.yaml
- resolver: lts-18
ghc: 8.10.7
ghc: '8.10.7'
stack-yaml: stack.yaml
- resolver: lts-19
ghc: 9.0.2
stack-yaml: stack.yaml
ghc: '9.0.2'
stack-yaml: stack-coveralls.yaml
- resolver: lts-20
ghc: 9.2.7
ghc: '9.2.8'
stack-yaml: stack.yaml
- resolver: lts-21
ghc: '9.4.7'
stack-yaml: stack.yaml
- resolver: nightly
stack-yaml: stack.yaml
# Latest stable for MacOS: ghc-8.8.4
- resolver: lts-16
os: macos-latest
ghc: '8.8.4'
stack-yaml: stack-old.yaml
# Latest stable for Windows: ghc-8.6.4
- resolver: lts-14
os: windows-latest
stack-yaml: stack-coveralls.yaml
ghc: '8.6.5'
stack-yaml: stack-old.yaml
env:
STACK_YAML: stack.yaml
STACK_YAML: '${{ matrix.stack-yaml }}'
STACK_ARGS: '--resolver ${{ matrix.resolver }} --system-ghc'
cache-version: v5 # bump up this version to invalidate currently stored cache
steps:
- uses: actions/checkout@v3

- uses: haskell/actions/setup@v2
- uses: haskell-actions/setup@v2
id: setup-haskell-stack
name: Setup Haskell
with:
Expand Down Expand Up @@ -158,44 +172,39 @@ jobs:
if: matrix.os == 'windows-latest'
with:
path: |
C:\\Users\\RUNNER~1\\AppData\\Roaming\\stack
C:\\Users\\RUNNER~1\\AppData\\Local\\Programs\\stack
key: ${{ runner.os }}-${{ matrix.resolver }}-programs-${{ env.cache-version }}
restore-keys: |
${{ runner.os }}-${{ matrix.resolver }}-programs-${{ env.cache-version }}
- name: Install Stack and GHC
- name: Reset modtime
run: |
set -ex
curl -sSL https://get.haskellstack.org/ | sh -s - -f
curl -sSL https://raw.githubusercontent.com/lehins/utils/c426e74aa129b7cb14e83305fd2639ccc41b03cd/haskell/git-modtime/git-modtime.hs -o git-modtime.hs
[ -n "${{ matrix.ghc }}" ] && [ "${{ matrix.os }}" == "ubuntu-latest" ] && STACK_ARGS="$STACK_ARGS --system-ghc"
[ -n "${{ matrix.stack-yaml }}" ] && STACK_YAML=${{ matrix.stack-yaml }}
# git-modtime.hs updates modification time of files to the latest commit time that
# a file was modified in. This ensures that stack does not rebuild unchanged
# files. More info in this SO answer:
# https://stackoverflow.com/questions/60906336/stack-haskell-build-cache-of-source-files-with-github-actions/61178945#61178945
# Windows is confused about stack's default user directory
stack $STACK_ARGS runghc -- git-modtime.hs -f .stack-work/tree-contents.txt
curl -sSL https://raw.githubusercontent.com/lehins/utils/master/haskell/git-modtime/git-modtime.hs -o git-modtime.hs
runhaskell -- git-modtime.hs -f .stack-work/tree-contents.txt
- name: Tests
- name: Build
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
run: |
set -ex
if [ "${{ matrix.os }}.${{ matrix.resolver }}" == "ubuntu-latest.lts-19" ] && [ -n "${COVERALLS_TOKEN}" ]; then
# Inspection tests aren't compatible with coverage
stack $STACK_ARGS build :spec :legacy-test --coverage --test --no-run-tests --haddock --no-haddock-deps
else
stack $STACK_ARGS build --test --no-run-tests --bench --no-run-benchmarks --haddock --no-haddock-deps
fi
- name: Test
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
run: |
set -ex
[ -n "${{ matrix.ghc }}" ] && [ "${{ matrix.os }}" == "ubuntu-latest" ] && STACK_ARGS="$STACK_ARGS --system-ghc"
[ -n "${{ matrix.stack-yaml }}" ] && STACK_YAML=${{ matrix.stack-yaml }}
if [ "${{ matrix.os }}.${{ matrix.resolver }}" == "ubuntu-latest.lts-14" ]; then
stack $STACK_ARGS test random:spec random:legacy-test --coverage --haddock --no-haddock-deps
if [ "${{ matrix.os }}.${{ matrix.resolver }}" == "ubuntu-latest.lts-19" ] && [ -n "${COVERALLS_TOKEN}" ]; then
stack $STACK_ARGS test :spec :legacy-test --coverage --haddock --no-haddock-deps
stack $STACK_ARGS hpc report --all
# Upload coverage report only when the token is available.
if [ -n "${COVERALLS_TOKEN}" ]; then
curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.6.1/shc-linux-x64-8.8.4.tar.bz2 | tar xj shc
./shc --repo-token="$COVERALLS_TOKEN" --partial-coverage --fetch-coverage combined custom
fi
elif [ "${{ matrix.resolver }}" == "lts-6" ]; then
# Inspection tests are not supported by pre ghc-8.0 compiler
stack $STACK_ARGS test random:spec random:legacy-test --bench --no-run-benchmarks --haddock --no-haddock-deps
curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.7.0/shc-Linux-X64.tar.bz2 | tar xj shc
./shc --repo-token="$COVERALLS_TOKEN" --partial-coverage --fetch-coverage combined custom
else
stack $STACK_ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps
fi
Expand Down
37 changes: 13 additions & 24 deletions random.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ tested-with: GHC == 8.0.2
, GHC == 8.8.4
, GHC == 8.10.7
, GHC == 9.0.2
, GHC == 9.2.4
, GHC == 9.4.1
, GHC == 9.2.8
, GHC == 9.4.7
, GHC == 9.6.3
, GHC == 9.8.1

source-repository head
type: git
Expand All @@ -90,19 +92,14 @@ library
default-language: Haskell2010
ghc-options:
-Wall
if impl(ghc >= 8.0)
ghc-options:
-Wincomplete-record-updates -Wincomplete-uni-patterns
-Wincomplete-record-updates -Wincomplete-uni-patterns

build-depends:
base >=4.9 && <5,
bytestring >=0.10.4 && <0.13,
deepseq >=1.1 && <2,
mtl >=2.2 && <2.4,
splitmix >=0.1 && <0.2
if impl(ghc < 8.0)
build-depends:
transformers

test-suite legacy-test
type: exitcode-stdio-1.0
Expand All @@ -116,10 +113,9 @@ test-suite legacy-test
RangeTest

default-language: Haskell2010
ghc-options: -with-rtsopts=-M8M
if impl(ghc >= 8.0)
ghc-options:
-Wno-deprecations
ghc-options:
-with-rtsopts=-M9M
-Wno-deprecations
build-depends:
base,
containers >=0.5 && <0.7,
Expand Down Expand Up @@ -170,19 +166,15 @@ test-suite spec-inspection
type: exitcode-stdio-1.0
main-is: Spec.hs
hs-source-dirs: test-inspection
build-depends:

default-language: Haskell2010
ghc-options: -Wall
other-modules:
Spec.Inspection
build-depends:
base,
random,
tasty >=1.0 && <1.6
if impl(ghc >= 8.0)
build-depends:
tasty-inspection-testing
other-modules:
Spec.Inspection
tasty >=1.0 && <1.6,
tasty-inspection-testing

benchmark legacy-bench
type: exitcode-stdio-1.0
Expand All @@ -191,10 +183,7 @@ benchmark legacy-bench
other-modules: BinSearch
default-language: Haskell2010
ghc-options:
-Wall -O2 -threaded -rtsopts -with-rtsopts=-N
if impl(ghc >= 8.0)
ghc-options:
-Wno-deprecations
-Wall -O2 -threaded -rtsopts -with-rtsopts=-N -Wno-deprecations

build-depends:
base,
Expand Down
12 changes: 3 additions & 9 deletions stack-coveralls.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
resolver: lts-14.27
resolver: lts-19.33
system-ghc: true
packages:
- .
extra-deps:
- splitmix-0.1@sha256:d50c4d0801a35be7875a040470c09863342514930c82a7d25780a6c2efc4fda9,5249
- rdtsc-1.3.0.1@sha256:0a6e8dc715ba82ad72c7e2b1c2f468999559bec059d50540719a80b00dcc4e66,1557
- smallcheck-1.2.0@sha256:8b431572e6a0503223e0e52014d41084c1b01f2aeea3bd499f6f529b3f6dfa89,1482
- tasty-bench-0.2.3@sha256:daa2221a1b1c65990633a51236f1cb4a52cba8ef0f0731f653e712a8bab07616,1319
- inspection-testing-0.4.5.0@sha256:938e7ce2ef42033071a5e60198c6e19ab61c411f5879b85821247a504f131768,8058
- tasty-inspection-testing-0.1@sha256:9c5e76345168fd3a59b43d305eebf8df3c792ce324c66bbdee45b54aa7d2c0ad,1214
- primitive-0.7.1.0@sha256:29de6bfd0cf8ba023ceb806203dfbec0e51e3524e75ffe41056f70b4229c6f0f,2728
extra-deps: []

0 comments on commit 7ada644

Please sign in to comment.