Update GHC and Cabal deps #256
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: | |
types: | |
- opened | |
- synchronize | |
jobs: | |
ci: | |
strategy: | |
fail-fast: false | |
matrix: | |
ghc: [ghc928, ghc945, ghc962] | |
name: Build and test on ${{ matrix.ghc }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v22 | |
with: | |
extra_nix_config: | | |
accept-flake-config = true | |
- uses: cachix/cachix-action@v12 | |
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@v3 | |
- uses: cachix/install-nix-action@v22 | |
with: | |
extra_nix_config: | | |
accept-flake-config = true | |
- name: Format via Cabal and 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@v3 | |
- uses: cachix/install-nix-action@v22 | |
with: | |
extra_nix_config: | | |
accept-flake-config = true | |
- uses: actions/cache@v3 | |
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@v3 | |
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@v3 | |
- uses: cachix/install-nix-action@v22 | |
with: | |
extra_nix_config: | | |
accept-flake-config = true | |
- uses: cachix/cachix-action@v12 | |
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@v3 | |
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@v3 | |
- name: Combine | |
run: | | |
cp wasm/ormolu.wasm frontend/ormolu.*.wasm | |
- uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: | | |
wasm | |
frontend | |
- name: Deploy to Netlify, preview | |
if: env.NETLIFY_AUTH_TOKEN != '' | |
uses: nwtgck/actions-netlify@v2 | |
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@v3 | |
- uses: haskell/actions/setup@v2 | |
with: | |
enable-stack: true | |
stack-no-global: true | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.stack | |
key: stack-${{ hashFiles('stack.yaml', 'ormolu.cabal') }} | |
- name: Build | |
run: stack build | |
- name: Test | |
run: stack test |