Skip to content

Format files in parallel #455

Format files in parallel

Format files in parallel #455

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
types:
- opened
- synchronize
jobs:
ci:
strategy:
fail-fast: false
matrix:
ghc: [ghc965, ghc982, ghc9101]
name: Build and test on ${{ matrix.ghc }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@V27
with:
extra_nix_config: |
accept-flake-config = true
- uses: cachix/cachix-action@v15
with:
name: tweag-ormolu
authToken: '${{ secrets.CACHIX_TWEAG_ORMOLU_AUTH_TOKEN }}'
- name: Build and run tests
run: |
nix build -L --keep-going .#${{ matrix.ghc }}.ci
lint:
needs: ci
name: Formatting and linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@V27
with:
extra_nix_config: |
accept-flake-config = true
- name: Format via Ormolu
run: |
nix run .#format
git diff --exit-code --color=always
- name: pre-commit-check
run: |
nix build -L .#pre-commit-check
live-wasm:
needs: lint
name: Build Ormolu WASM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@V27
with:
extra_nix_config: |
accept-flake-config = true
- uses: actions/cache@v4
with:
path: |
~/.ghc-wasm/.cabal/store
ormolu-live/dist-newstyle
key: wasm-${{ github.run_id }}
restore-keys: |
wasm-${{ github.run_id }}
wasm-
- name: Build Ormolu WASM
run: |
cd ormolu-live
nix develop .#ghcWasm -c sh -c \
'wasm32-wasi-cabal update && ./build-wasm.sh -Oz'
- uses: actions/upload-artifact@v4
with:
name: wasm
path: ormolu-live/src/ormolu.wasm
live-frontend:
needs: lint
name: Build Ormolu Live frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@V27
with:
extra_nix_config: |
accept-flake-config = true
- uses: cachix/cachix-action@v15
with:
name: tweag-ormolu
authToken: '${{ secrets.CACHIX_TWEAG_ORMOLU_AUTH_TOKEN }}'
- name: Build frontend
run: |
nix build -L .#ormoluLive
cp -r --no-preserve=mode,ownership result/ site
- uses: actions/upload-artifact@v4
with:
name: frontend
path: site/
live-deploy:
needs: [live-wasm, live-frontend]
name: Deploy Ormolu Live
runs-on: ubuntu-latest
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
steps:
- uses: actions/download-artifact@v4
- name: Combine
run: |
cp wasm/ormolu.wasm frontend/ormolu.*.wasm
- name: Deploy to Netlify, preview
if: env.NETLIFY_AUTH_TOKEN != ''
uses: nwtgck/actions-netlify@v3
with:
publish-dir: ./frontend
github-token: ${{ secrets.GITHUB_TOKEN }}
alias: ${{ github.event.pull_request.head.sha || github.sha }}
enable-pull-request-comment: true
enable-commit-comment: false
enable-commit-status: true
- name: Deploy to Netlify, production
if: env.NETLIFY_AUTH_TOKEN != '' && github.ref == 'refs/heads/master'
run: |
netlify deploy --prod -d ./frontend
# prevent stack.yaml from becoming outdated
stack:
name: Build and test via Stack
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
with:
enable-stack: true
stack-no-global: true
- uses: actions/cache@v4
with:
path: ~/.stack
key: stack-${{ hashFiles('stack.yaml', 'ormolu.cabal') }}
- name: Build
run: stack build
- name: Test
run: stack test