-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
228683a
commit e6189f7
Showing
1 changed file
with
77 additions
and
30 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,102 @@ | ||
on: [push] | ||
name: haskell-ci | ||
jobs: | ||
build: | ||
hlint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: haskell-actions/hlint-setup@v2 | ||
- uses: haskell-actions/hlint-run@v2 | ||
with: | ||
path: . | ||
fail-on: warning | ||
ormolu: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: haskell-actions/run-ormolu@v11 | ||
cabal: | ||
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ghc: ['8.6.5', '8.8.4', '8.10.7', '9.2.5', '9.4.4'] | ||
os: [ubuntu-latest] | ||
ghc-version: ['9.8', '9.6', '9.4', '9.2', '8.10'] | ||
docspec: [false] | ||
experimental: [false] | ||
|
||
include: | ||
- os: windows-latest | ||
ghc: '9.4.3' | ||
experimental: true | ||
- os: macOS-latest | ||
ghc: '9.2.5' | ||
experimental: true | ||
ghc-version: '9.6' | ||
- os: macos-latest | ||
ghc-version: '9.6' | ||
- os: ubuntu-latest | ||
ghc: '9.2.5' | ||
experimental: true | ||
ghc-version: '9.6' | ||
docspec: true | ||
continue-on-error: true | ||
name: ghc ${{ matrix.ghc }} ${{ matrix.os }} | ||
experimental: true | ||
name: docspec | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: haskell/actions/setup@v2 | ||
|
||
- name: Set up GHC ${{ matrix.ghc-version }} | ||
uses: haskell-actions/setup@v2 | ||
id: setup | ||
with: | ||
ghc-version: ${{ matrix.ghc-version }} | ||
|
||
- name: Installed minor versions of GHC and Cabal | ||
shell: bash | ||
run: | | ||
GHC_VERSION=$(ghc --numeric-version) | ||
CABAL_VERSION=$(cabal --numeric-version) | ||
echo "GHC_VERSION=${GHC_VERSION}" >> "${GITHUB_ENV}" | ||
echo "CABAL_VERSION=${CABAL_VERSION}" >> "${GITHUB_ENV}" | ||
- name: Configure the build | ||
run: | | ||
cabal configure --enable-tests --enable-benchmarks --disable-documentation | ||
cabal build --dry-run | ||
# The last step generates dist-newstyle/cache/plan.json for the cache key. | ||
|
||
- name: Restore cached dependencies | ||
uses: actions/cache/restore@v3 | ||
id: cache | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
enable-stack: false | ||
- uses: actions/cache@v3 | ||
path: ${{ steps.setup.outputs.cabal-store }} | ||
key: ${{ runner.os }}-ghc-${{ env.GHC_VERSION }}-cabal-${{ env.CABAL_VERSION }}-plan-${{ hashFiles('**/plan.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-ghc-${{ env.GHC_VERSION }}-cabal-${{ env.CABAL_VERSION }}- | ||
- name: Install dependencies | ||
run: cabal build all --only-dependencies | ||
|
||
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail. | ||
- name: Save cached dependencies | ||
uses: actions/cache/save@v3 | ||
# Caches are immutable, trying to save with the same key would error. | ||
if: ${{ !steps.cache.outputs.cache-hit | ||
|| steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key }} | ||
with: | ||
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }} | ||
path: ~/.cabal/store | ||
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- | ||
path: ${{ steps.setup.outputs.cabal-store }} | ||
key: ${{ steps.cache.outputs.cache-primary-key }} | ||
|
||
- name: Build | ||
run: cabal build all | ||
|
||
- name: Check cabal file | ||
run: cabal check | ||
|
||
- if: matrix.docspec | ||
name: install cabal-docspec | ||
name: cabal-docspec | ||
run: | | ||
mkdir -p $HOME/.cabal/bin | ||
echo "$HOME/.cabal/bin" >> $GITHUB_PATH | ||
curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20210111/cabal-docspec-0.0.0.20210111.xz > cabal-docspec.xz | ||
echo '0829bd034fba901cbcfe491d98ed8b28fd54f9cb5c91fa8e1ac62dc4413c9562 cabal-docspec.xz' | sha256sum -c - | ||
curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20230406/cabal-docspec-0.0.0.20230406-x86_64-linux.xz > cabal-docspec.xz | ||
echo '68fa9addd5dc453d533a74a763950499d4593b1297c9a05c3ea5bd1acc04c9dd cabal-docspec.xz' | sha256sum -c - | ||
xz -d < cabal-docspec.xz > $HOME/.cabal/bin/cabal-docspec | ||
rm -f cabal-docspec.xz | ||
chmod a+x $HOME/.cabal/bin/cabal-docspec | ||
$HOME/.cabal/bin/cabal-docspec --version | ||
- name: cabal build | ||
run: | | ||
cabal update | ||
cabal configure --enable-tests | ||
cabal build | ||
cabal test | ||
- if: matrix.docspec | ||
name: run cabal-docspec | ||
run: cabal-docspec --check-properties | ||
cabal-docspec |