Dev Ops changes #15
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 | |
jobs: | |
on-main-pull-request: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Set up Haskell | |
uses: haskell-actions/[email protected] | |
with: | |
ghc-version: '9.6.3' | |
cabal-version: '3.10.2.1' | |
- name: Cache Cabal | |
uses: actions/[email protected] | |
env: | |
cache-name: cache-cabal | |
with: | |
path: ~/.cabal | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Cache GHC | |
uses: actions/cache@v2 | |
with: | |
path: ~/.ghcup | |
key: ${{ runner.os }}-ghcup-${{ hashFiles('**/*.cabal') }} | |
restore-keys: | | |
${{ runner.os }}-ghcup- | |
- name: Install stylish-haskell | |
run: cabal install stylish-haskell | |
- name: Run stylish-haskell | |
run: | | |
find . -name '*.hs' -exec sh -c 'for file do stylish-haskell --inplace "$file"; done' sh {} + | |
- name: Commit stylish-haskell changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Auto-format with stylish-haskell | |
commit_user_name: GitHub Action | |
commit_user_email: [email protected] | |
branch: ${{ github.head_ref }} | |
- name: Build package | |
run: | | |
cabal update | |
cabal new-build all |