Skip to content

CostModel: account for unitary ops (#49) #198

CostModel: account for unitary ops (#49)

CostModel: account for unitary ops (#49) #198

Workflow file for this run

name: CI
on:
push:
branches: main
pull_request:
branches: main
# INFO: The following configuration block ensures that only one build runs per branch,
# which may be desirable for projects with a costly build process.
# Remove this block from the CI workflow to let each CI job run to completion.
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
jobs:
format:
name: Check Formatting (fourmolu)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/run-fourmolu@v11
with:
version: "0.18.0.0"
pattern: |
src/**/*.hs
test/**/*.hs
tools/**/*.hs
hpack:
name: Check hpack generated config
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install hpack
run: curl -sSL https://raw.githubusercontent.com/sol/hpack/main/get-hpack.sh | bash
- name: Run hpack
run: hpack && git diff --exit-code
build:
name: Build and test (cabal)
needs: hpack
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ghc-version:
# - "8.6.5"
# - "8.8.4"
# - "8.10.7"
- "9.4.8"
- "9.6.7"
- "9.8.4"
- "9.10.3"
- "9.12.2"
steps:
- uses: actions/checkout@v4
- name: Set up GHC ${{ matrix.ghc-version }}
uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: ${{ matrix.ghc-version }}
# Defaults, added for clarity:
cabal-version: 'latest'
cabal-update: true
- name: Configure the build
run: |
cabal configure --enable-tests --enable-benchmarks --enable-documentation
cabal build all --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.
- name: Restore cached dependencies
uses: actions/cache/restore@v4
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') }}
restore-keys: ${{ env.key }}-
- name: Install dependencies
# If we had an exact cache hit, the dependencies will be up to date.
if: steps.cache.outputs.cache-hit != 'true'
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@v4
# If we had an exact cache hit, trying to save the cache would error because of key clash.
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Build
run: cabal build all
- name: Run tests
run: cabal test all
- name: Check cabal file
run: cabal check
- name: Build documentation
run: cabal haddock all
pages:
runs-on: ubuntu-latest
needs: build # build documentation only when all tests pass
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up GHC 9.6.7
uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: "9.6.7"
- name: Configure the build
run: |
cabal configure --disable-tests --disable-benchmarks --disable-documentation
cabal build all --dry-run
cabal haddock all --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.
- name: Restore cached dependencies
uses: actions/cache/restore@v4
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') }}
restore-keys: ${{ env.key }}-
- name: Build documentation
run: cabal haddock all
# 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@v4
# If we had an exact cache hit, trying to save the cache would error because of key clash.
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Deploy to GH pages
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist-newstyle/build/x86_64-linux/ghc-9.6.7/traq-*/doc/html/traq/
force_orphan: true