Configure build and ci #12
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: CI Pull Request | |
on: | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: write | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
on-main-pull-request: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
cabal: [3.10.2.1] | |
ghc: [9.6.3] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Set up Haskell | |
uses: haskell-actions/[email protected] | |
id: setup | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
cabal-update: true | |
- name: Set up rustup nightly | |
run: | | |
rustup toolchain install nightly | |
- name: Set up cargo-c | |
run: | | |
cargo install cargo-c | |
- name: Configure Cabal | |
run: | | |
cabal update | |
cabal configure --enable-tests --enable-benchmarks --enable-documentation | |
- name: Generate cache key | |
# Creates plan.json file | |
run: | | |
cabal build all --dry-run | |
- name: Restore cached dependencies | |
uses: actions/cache/[email protected] | |
id: cache | |
env: | |
key: ${{ matrix.os }}-ghc-${{ matrix.ghc }}-cabal-${{ matrix.cabal }} | |
with: | |
path: ${{ steps.setup.outputs.cabal-store }} | |
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} | |
restore-keys: ${{ env.key }}- | |
- name: Install stylish-haskell | |
run: | | |
cabal install stylish-haskell-0.14.5.0 | |
- name: Cargo clippy | |
run: | | |
cargo clippy --manifest-path rust-wrapper/Cargo.toml -- -D warnings | |
- name: Rust format | |
run: | | |
cargo fmt --manifest-path rust-wrapper/Cargo.toml | |
- name: Lint Haskell | |
run: | | |
find . -name '*.hs' -exec sh -c 'for file do stylish-haskell --inplace "$file"; done' sh {} + | |
- name: Auto-commit lint | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: stylish-haskell auto-commit | |
commit_user_name: GitHub Action | |
commit_user_email: [email protected] | |
branch: ${{ github.head_ref }} | |
- 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/[email protected] | |
# 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 -f Pedantic | |
# - name: Test | |
# run: cabal test all | |
# - name: Check cabal file | |
# run: cabal check | |
# - name: Document package | |
# run: cabal haddock all | |
# - name: Prepare package for publishing | |
# run: cabal sdist all |