Skip to content

Commit

Permalink
Dev Ops changes
Browse files Browse the repository at this point in the history
* add stack files to gitignore
* modify CI
  - rename haskell-ci to main-push
  - add main-pull to run on pull requests
  - include tests and linting in main-pull

See #68 and #69
  • Loading branch information
echatav committed Apr 11, 2024
1 parent 38a8b11 commit 35fa5f4
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 3 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/main-pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Haskell CI
name: CI Push

on:
push:
branches: [ "main" ]
branches: [ main ]

workflow_dispatch:

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*
compiled_scripts/*
compiled_scripts/*
stack.yaml*

0 comments on commit 35fa5f4

Please sign in to comment.