Merge pull request #23 from rickowens/pr #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push] | |
name: Haskell Builds | |
jobs: | |
build: | |
name: Haskell Build | |
runs-on: ubuntu-latest # or macOS-latest, or windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ghc-version: | |
- '9.6' | |
- '9.8' | |
- '9.10' | |
cabal-version: ['3.8.1.0'] | |
steps: | |
# Checkout | |
- uses: actions/checkout@v3 | |
# Setup | |
- name: Setup Haskell | |
uses: haskell-actions/setup@v2 | |
id: setup | |
if: steps.tooling-cache.outputs.cache-hit != 'true' | |
with: | |
ghc-version: ${{ matrix.ghc-version }} | |
cabal-version: ${{ matrix.cabal-version }} | |
# Generate Plan | |
- name: Configure the Build | |
run: | | |
rm cabal.project.freeze | |
cabal configure --enable-tests --disable-optimization | |
cabal build --dry-run | |
# Restore cache | |
- name: Restore cached dependencies | |
uses: actions/cache/restore@v3 | |
id: cache | |
env: | |
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} | |
with: | |
path: ${{ steps.setup.outputs.cabal-store }} | |
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} | |
# Build deps (for caching) | |
- name: Cabal build dependencies | |
run: cabal build all --only-dependencies | |
# Save dependency cache | |
- name: Save cache | |
uses: actions/cache/save@v3 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
path: ${{ steps.setup.outputs.cabal-store }} | |
key: ${{ steps.cache.outputs.cache-primary-key }} | |
# Cabal build | |
- name: Cabal Bulid | |
run: | | |
project="$(cat cabal.project | grep -v -- '-Werror')" | |
echo "$project" > cabal.project | |
cabal build all | |
# Cabal test | |
- name: Cabal Test | |
run: | | |
project="$(cat cabal.project | grep -v -- '-Werror')" | |
echo "$project" > cabal.project | |
cabal test all | |
build-lower-bounds: | |
name: Haskell Build (lower bounds) | |
runs-on: ubuntu-latest # or macOS-latest, or windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ghc-version: ['9.2.1'] | |
cabal-version: ['3.8.1.0'] | |
steps: | |
# Checkout | |
- uses: actions/checkout@v3 | |
# Setup | |
- name: Setup Haskell | |
uses: haskell-actions/setup@v2 | |
id: setup | |
if: steps.tooling-cache.outputs.cache-hit != 'true' | |
with: | |
ghc-version: ${{ matrix.ghc-version }} | |
cabal-version: ${{ matrix.cabal-version }} | |
# Generate Plan | |
- name: Configure the Build | |
run: | | |
(cat << EOF | |
packages: . | |
constraints: | |
aeson == 2.0.3.0, | |
base == 4.16.0.0, | |
bytestring == 0.11.1.0, | |
containers == 0.6.4.1, | |
hspec == 2.8.5, | |
scientific == 0.3.7.0, | |
text == 1.2.5.0, | |
time == 1.9.3, | |
vector == 0.12.3.1 | |
EOF | |
) > cabal.project | |
rm cabal.project.freeze | |
cabal configure --enable-tests --disable-optimization | |
cabal build --dry-run | |
# Restore cache | |
- name: Restore cached dependencies | |
uses: actions/cache/restore@v3 | |
id: cache | |
env: | |
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} | |
with: | |
path: ${{ steps.setup.outputs.cabal-store }} | |
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} | |
# Build deps (for caching) | |
- name: Cabal build dependencies | |
run: cabal build all --only-dependencies | |
# Save dependency cache | |
- name: Save cache | |
uses: actions/cache/save@v3 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
path: ${{ steps.setup.outputs.cabal-store }} | |
key: ${{ steps.cache.outputs.cache-primary-key }} | |
# Cabal build | |
- name: Cabal Bulid | |
run: cabal build all | |
# Cabal test | |
- name: Cabal Test | |
run: cabal test all |