Support ghc 9.10 #373
Workflow file for this run
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
--- | |
name: Haskell CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
types: [opened, reopened, synchronize, labeled] | |
jobs: | |
enumerate: | |
name: Enumerate CI configurations | |
runs-on: ubuntu-latest | |
outputs: | |
configs: ${{ steps.enumerate.outputs.configs }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: enumerate | |
run: | | |
ls -1 ci-configs/| grep -o -P '.*(?=.config)'| jq -n -R -c '[inputs]' | tee configs.json | |
echo "configs=$(cat configs.json)" >> $GITHUB_OUTPUT | |
build: | |
needs: enumerate | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
plan: ${{ fromJSON(needs.enumerate.outputs.configs) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: cache cabal store | |
uses: actions/cache@v3 | |
with: | |
key: cabal-store-${{ runner.os }}-${{ matrix.plan }}-${{ github.sha }} | |
path: ~/.cabal/store | |
restore-keys: cabal-store-${{ runner.os }}-${{ matrix.plan }}- | |
- uses: actions/checkout@v3 | |
with: | |
repository: 'dfinity/candid' | |
path: candid | |
ref: a8322be53bfced317bdf4ffff5dbc428d24dc612 | |
- name: Detect GHC version | |
run: | | |
ver=$(grep -o -P '(?<=with-compiler: ghc-).*' ci-configs/${{ matrix.plan }}.config) | |
echo "Detected compiler version $ver in ci-configs/${{ matrix.plan }}.config" | |
echo "ghc_version=$ver" >> $GITHUB_ENV | |
- uses: haskell-actions/setup@v2 | |
with: | |
ghc-version: ${{ env.ghc_version }} | |
ghcup-release-channel: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml | |
- name: Fetch cabal-force-upper-bounds | |
if: matrix.plan == 'upper-bounds' | |
run: | | |
curl -L https://github.com/nomeata/cabal-force-upper-bound/releases/latest/download/cabal-force-upper-bound.linux.gz | gunzip > /usr/local/bin/cabal-force-upper-bound | |
chmod +x /usr/local/bin/cabal-force-upper-bound | |
- name: Special handling for upper-bounds | |
if: matrix.plan == 'upper-bounds' | |
run: | | |
echo -n "extra_flags=" >> $GITHUB_ENV | |
cabal-force-upper-bound --allow-newer *.cabal >> $GITHUB_ENV | |
- name: Build | |
run: | | |
cabal --version | |
ghc --version | |
cabal update | |
# build first, so that the .ghc.environment file is written | |
cabal build --enable-tests --minimize-conflict-set --project-file "ci-configs/${{ matrix.plan }}.config" ${{ env.extra_flags }} | |
# then the doctest has a chance of succeeding | |
export CANDID_TESTS=$PWD/candid/test | |
cabal v2-test --project-file "ci-configs/${{ matrix.plan }}.config" ${{ env.extra_flags }} | |
- run: mv dist-newstyle/cache/plan.json plan-${{ matrix.plan }}.json | |
- name: Upload build plan as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: plans | |
path: plan-${{ matrix.plan }}.json | |
bounds: | |
runs-on: ubuntu-latest | |
name: Calculate cabal bounds | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Fetch cabal-plan-bounds | |
run: | | |
curl -L https://github.com/nomeata/cabal-plan-bounds/releases/latest/download/cabal-plan-bounds.linux.gz | gunzip > /usr/local/bin/cabal-plan-bounds | |
chmod +x /usr/local/bin/cabal-plan-bounds | |
- name: Load plans | |
uses: actions/download-artifact@v3 | |
with: | |
name: plans | |
path: plans | |
- run: find plans/ | |
- run: cabal-plan-bounds plans/*.json -c candid.cabal | |
- run: git diff candid.cabal | |
- name: Push updated .cabal file if labeled update-bounds | |
if: contains(github.event.pull_request.labels.*.name, 'update-bounds') | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Update cabal bounds based on build plans | |
file_pattern: '*.cabal' | |
- name: Fail if .cabal file was changed | |
run: git diff-files --quiet candid.cabal|| exit 1 | |
docs: | |
strategy: | |
matrix: | |
ghc: | |
- '8.10' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: cache cabal store | |
uses: actions/cache@v3 | |
with: | |
key: cabal-store-docs-${{ runner.os }}-${{ github.sha }} | |
path: ~/.cabal/store | |
restore-keys: cabal-store-docs-${{ runner.os }}- | |
- uses: haskell/actions/setup@v2 | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
- name: Build | |
run: | | |
cabal --version | |
ghc --version | |
cabal update | |
cabal haddock --haddock-hyperlink-source --haddock-quickjump --haddock-html-location='https://hackage.haskell.org/package/$pkg-$version/docs' | |
mv dist-newstyle/build/*/*/*/doc/html/candid gh-page | |
touch gh-page/.nojekyll | |
- name: Deploy to Github Pages | |
if: github.ref == 'refs/heads/master' | |
uses: JamesIves/github-pages-deploy-action@releases/v4 | |
with: | |
ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: gh-page | |
SINGLE_COMMIT: true |