Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] fix CI #174

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 16 additions & 94 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,101 +14,23 @@ on:
- cron: '0 0 1 * *'

jobs:
# Check that the build passes with stack on all the provided snapshots, and
# thus all the supported ghc versions.
stack:
name: ${{ matrix.stack_yaml }}
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
stack_yaml:
- stack-8.6.5.yaml
- stack-8.8.4.yaml
- stack-8.10.7.yaml
- stack-9.0.2.yaml
- stack-9.2.7.yaml
- stack-9.4.5.yaml
- stack-9.6.1.yaml
os:
- ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
name: Cache Stack Artifacts
with:
path: |
~/.stack
.stack-work
key: ${{ runner.os }}-stack-${{ hashFiles(matrix.stack_yaml) }}

- uses: haskell-actions/setup@v2
id: setup-haskell-stack
name: Setup Stack
with:
enable-stack: true
stack-setup-ghc: true
stack-no-global: true

- name: Build
run: |
stack --stack-yaml=${{ matrix.stack_yaml }} install --test --bench --no-run-tests --no-run-benchmarks

- name: Test
run: |
stack --stack-yaml=${{ matrix.stack_yaml }} test

- name: Double-check the example file
run: |
stack --stack-yaml=${{ matrix.stack_yaml }} exec -- runghc examples/example.hs | diff examples/expected.txt -

# Check that the build passes with cabal with the latest version of our
# dependencies.
cabal:
name: newest
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- ghc-version: '9.8.1'
os: ubuntu-latest

ghc: ['8.6.5', '8.8.4']
cabal: ['2.4.1.0', '3.0.0.0']
os: [ubuntu-latest, macOS-latest, windows-latest]
exclude:
# GHC 8.8+ only works with cabal v3+
- ghc: 8.8.4
cabal: 2.4.1.0
name: Haskell GHC ${{ matrix.ghc }} sample
steps:
- uses: actions/checkout@v2

- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
name: Setup Cabal
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}

# This freeze file is regenerated on every build, so we will always test
# with the most recent version of our dependencies allowed by our upper
# bounds.
- name: Freeze
run: |
cabal v2-configure --enable-tests --enable-benchmarks --test-show-details=direct
cabal freeze

# Only reuse the cached copy of our dependencies if our freeze file matches
# the cache's copy.
- uses: actions/cache@v2
name: Cache Cabal Artifacts
with:
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-cabal-v2-${{ hashFiles('cabal.project.freeze') }}

- name: Build
run: |
cabal v2-build --enable-tests

- name: Test
run: |
cabal v2-test

- name: Double-check the example file
run: |
cabal v2-exec -- runghc examples/example.hs | diff examples/expected.txt -
- uses: actions/checkout@v3
- name: Setup Haskell
uses: haskell/actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- run: runhaskell Hello.hs
2 changes: 2 additions & 0 deletions Hello.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
main :: IO ()
main = putStrLn "hello!"
Loading