Backwards compatible formatting #154
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: Backwards compatible formatting | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 0 * * *' # nightly | |
jobs: | |
format_compat: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- | |
name: cabal | |
repo: haskell/cabal | |
# TODO: pin this to the next released version of Cabal that uses fourmolu | |
ref: 439d68efb74bd8f1c2215301d214d9459acdfa63 | |
cmd: fourmolu -m check Cabal Cabal-syntax cabal-install | |
- | |
name: swarm | |
repo: swarm-game/swarm | |
ref: 0.4.0.0 | |
cmd: fourmolu -m check src app test | |
name: 'format_compat: ${{ matrix.name }}' | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Check out Fourmolu | |
uses: actions/checkout@v4 | |
with: | |
path: fourmolu | |
- | |
uses: actions/cache@v3 | |
with: | |
path: ~/.stack | |
key: ${{ runner.os }}-format_compat-${{ hashFiles('fourmolu/stack.yaml', 'fourmolu/fourmolu.cabal') }} | |
- | |
name: Install fourmolu | |
working-directory: fourmolu | |
run: | | |
stack install | |
echo "${HOME}/.local/bin" >> "${GITHUB_PATH}" | |
- | |
name: Check out ${{ matrix.repo }} | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ matrix.repo }} | |
ref: ${{ matrix.ref }} | |
path: target/ | |
- | |
name: Run fourmolu | |
working-directory: target | |
run: | | |
git apply --allow-empty ../fourmolu/compat-tests/${{ matrix.name }}.diff | |
${{ matrix.cmd }} | |
- | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.name }}-compat-diff | |
path: target/${{ matrix.name }}.diff |