refactor run goldplate step in ci #582
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 | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macOS-latest | |
ghc: | |
- '9.8.2' | |
- '9.6.4' | |
- '9.4.8' | |
- '9.2.8' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: haskell-actions/setup@v2 | |
id: setup-haskell | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
- name: Configure the build and dry-run it | |
run: | | |
cabal configure --enable-tests --jobs --flags=pedantic | |
cabal build all --dry-run | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ steps.setup-haskell.outputs.cabal-store }} | |
key: ci-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/plan.json') }} | |
restore-keys: | | |
ci-${{ runner.os }}-${{ matrix.ghc }}- | |
- name: Test | |
run: cabal test | |
- name: Install | |
run: cabal install --overwrite-policy=always | |
- name: Run golden tests | |
env: | |
GOLDPLATE_VERSION: 0.2.1 | |
GOLDPLATE_TAGNAME: v${GOLDPLATE_VERSION} | |
run: | | |
case "$OSTYPE" in | |
linux* ) | |
curl -L "https://github.com/fugue/goldplate/releases/download/${GOLDPLATE_TAGNAME}/goldplate-${GOLDPLATE_TAGNAME}-linux-x86_64.tar.gz" | tar xz -C . goldplate | |
;; | |
darwin* ) | |
curl -L "https://github.com/fugue/goldplate/releases/download/${GOLDPLATE_TAGNAME}/goldplate-${GOLDPLATE_TAGNAME}-darwin-x86_64.tar.gz" | tar xz -C . goldplate | |
;; | |
esac | |
./goldplate --pretty-diff golden-test | |
cabal-format: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
ghc: ['9.2.8'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: haskell-actions/setup@v2 | |
id: setup-haskell | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ steps.setup-haskell.outputs.cabal-store }} | |
key: format-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project') }} | |
restore-keys: | | |
format-${{ runner.os }}-${{ matrix.ghc }}- | |
- name: Install cabal-fmt | |
run: cabal install --overwrite-policy=always -j cabal-fmt | |
- name: Run cabal-fmt | |
run: cabal-fmt --check --Werror haskellorls.cabal | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run ormolu | |
uses: mrkkrp/ormolu-action@v15 | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: haskell-actions/hlint-setup@v2 | |
with: | |
version: '3.6.1' | |
- name: Run hlint | |
uses: haskell-actions/hlint-run@v2 | |
with: | |
fail-on: status | |
path: '["app/", "src/", "test/"]' | |
actionlint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run actionlint | |
run: | | |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) | |
./actionlint -color |