Skip to content

Commit

Permalink
improve ci (#226)
Browse files Browse the repository at this point in the history
* fixed macos ci by intalling stack

* use haskell-actions

* install llvm@12

* only macos

* fixed llvm@12 path

* print path and llvm dir

* brew reccommended paths

* remove Cellar

* add opt

* ls brew prefix

* more ls

* fixed paths

* splitting matrix into different jobs

* invalid strategy

* fixed os name

* find error

* indent

* build

* @->V

* test old

* remove anchor

* old steps

* checkout@2

* narrow

* widen

* widen

* narrow

* widen

* move checkout

* for resolver

* narrow

* widen

* install llvm@12

* matrix

* fix list

* quotes

* lts

* added other OSs

* added --extra-*-dir instead of env var

* removed single quotes

* libffi

* removed quotes

* -I to extra-include-dirs

* specific path

* llvm 12 -> 13

* cache stack work

* widen lts versions

* stack path reorder

* print largest cache file size

* exclude .stack/programs

* use haskell-actions to install ghc\ninstead of stack so ghc is not cached

* clean up

* added cabal builds

* use sh and cabal

* install correct ghc version non-macos, show versions

* added cabal.project

* chaned cache paths for windows

* unique ids

* minimize conflict set

* restore-keys, fixed stack cache path

* base_ref

* base_ref -> head_ref, cabal uses 9.8.2

* cabal uses 9.8.2

* use haskell setup for all OSs

* added build-tools: hspec-discover

* cabal cleanup
  • Loading branch information
BebeSparkelSparkel committed Jul 12, 2024
1 parent 0447f25 commit 8ada6b1
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 20 deletions.
107 changes: 87 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,97 @@ jobs:
name: Stack
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
resolver:
# Missing some packages now
#- "--resolver nightly"
- lts-18.16 # Win32 issue
- lts-16
stack-yaml:
- stack.yaml
- stack-new-time.yaml
exclude:
- resolver: lts-16
stack-yaml: stack-new-time.yaml
- os: windows-latest
stack-yaml: stack-new-time.yaml

os:
- macos-latest
- ubuntu-latest
- windows-latest
versions:
#- <lts version> <ghc version>
- 22.28 9.6.6
- 21.25 9.4.8
- 20.26 9.2.8
- 19.33 9.0.2
- 18.28 8.10.7
steps:
- name: Parse lts and ghc versions
shell: sh
run: |
echo snapshot=$(echo ${{ matrix.versions }} | cut -d ' ' -f 1) >> $GITHUB_ENV
echo ghcVersion=$(echo ${{ matrix.versions }} | cut -d ' ' -f 2) >> $GITHUB_ENV
- name: Install LLVM 13
if: ${{ matrix.os == 'macos-latest' && env.snapshot < 20 }}
shell: sh
run: |
brew install llvm@13
echo "/opt/homebrew/opt/llvm@13/bin" >> $GITHUB_PATH
echo extraLibDirs="--extra-lib-dirs /opt/homebrew/opt/llvm@13/lib" >> $GITHUB_ENV
echo extraIncludeDirsLLVM="--extra-include-dirs /opt/homebrew/opt/llvm@13/include" >> $GITHUB_ENV
echo extraIncludeDirsFFI="--extra-include-dirs /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/ffi" >> $GITHUB_ENV
- name: Setup Haskell
id: setup-haskell-stack
uses: haskell-actions/setup@v2.7
with:
ghc-version: ${{ env.ghcVersion }}
enable-stack: true
stack-version: 'latest'
cabal-update: false
- name: Clone project
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Use Cache
uses: actions/cache@v4
with:
key: ${{ matrix.os }}_${{ env.snapshot }}_${{ github.head_ref }}
restore-keys: |
${{ matrix.os }}_${{ env.snapshot }}_${{ github.head_ref }}
${{ matrix.os }}_${{ env.snapshot }}_${{ github.base_ref }}
${{ matrix.os }}_${{ env.snapshot }}_
${{ matrix.os }}_${{ env.snapshot }}
path: |
${{ steps.setup-haskell-stack.outputs.stack-root }}
.stack-work
*/.stack-work
- name: Build and run tests
shell: bash
run: |
set -ex
ghc --version
stack --version
stack test --system-ghc $extraLibDirs $extraIncludeDirsLLVM $extraIncludeDirsFFI --fast --no-terminal --snapshot=lts-$snapshot
Cabal:
name: Cabal
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-latest
- macos-13
- ubuntu-latest
- windows-latest
steps:
- name: Setup Haskell
id: setup-haskell-cabal
uses: haskell-actions/setup@v2.7
with:
ghc-version: 9.6.6
- name: Clone project
uses: actions/checkout@v4
- name: Use Cache
uses: actions/cache@v4
with:
key: ${{ matrix.os }}_cabal_${{ github.head_ref }}
restore-keys: |
${{ matrix.os }}_cabal_${{ github.head_ref }}
${{ matrix.os }}_cabal_${{ github.base_ref }}
${{ matrix.os }}_cabal_
${{ matrix.os }}_cabal
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
dist-newstyle
- name: Build and run tests
shell: bash
run: |
set -ex
stack --version
stack test --fast --no-terminal --stack-yaml=${{ matrix.stack-yaml }} --resolver=${{ matrix.resolver }}
ghc --version
cabal --version
cabal test --minimize-conflict-set -O0 all
2 changes: 2 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
*/*.cabal
2 changes: 2 additions & 0 deletions classy-prelude-conduit/classy-prelude-conduit.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ test-suite spec
Paths_classy_prelude_conduit
hs-source-dirs:
test
build-tool-depends:
hspec-discover:hspec-discover
build-depends:
QuickCheck
, base >=4.13 && <5
Expand Down
1 change: 1 addition & 0 deletions classy-prelude-conduit/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ tests:
- classy-prelude-conduit
- QuickCheck
- conduit
build-tools: hspec-discover
2 changes: 2 additions & 0 deletions classy-prelude/classy-prelude.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ test-suite test
hs-source-dirs:
test
ghc-options: -Wall
build-tool-depends:
hspec-discover:hspec-discover
build-depends:
QuickCheck
, base >=4.13 && <5
Expand Down
1 change: 1 addition & 0 deletions classy-prelude/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ tests:
- hspec >=1.3
- QuickCheck
- containers
build-tools: hspec-discover
2 changes: 2 additions & 0 deletions mono-traversable/mono-traversable.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ test-suite test
hs-source-dirs:
test
ghc-options: -O0
build-tool-depends:
hspec-discover:hspec-discover
build-depends:
HUnit
, QuickCheck
Expand Down
1 change: 1 addition & 0 deletions mono-traversable/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ tests:
- containers
- unordered-containers
- foldl
build-tools: hspec-discover
benchmarks:
all:
main: main.hs
Expand Down
2 changes: 2 additions & 0 deletions mutable-containers/mutable-containers.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ test-suite test
Paths_mutable_containers
hs-source-dirs:
test
build-tool-depends:
hspec-discover:hspec-discover
build-depends:
QuickCheck
, base >=4.13 && <5
Expand Down
1 change: 1 addition & 0 deletions mutable-containers/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ tests:
- hspec
- QuickCheck
- primitive
build-tools: hspec-discover
benchmarks:
deque:
main: deque.hs
Expand Down

0 comments on commit 8ada6b1

Please sign in to comment.