Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WASM-based Ormolu Live #964

Merged
merged 3 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,88 @@ jobs:
- 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@v18
with:
# https://github.com/NixOS/nix/issues/7644
install_url: https://releases.nixos.org/nix/nix-2.12.0/install
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@v18
with:
# https://github.com/NixOS/nix/issues/7644
install_url: https://releases.nixos.org/nix/nix-2.12.0/install
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ result*
# These are touched on every :reload in GHCi.
# https://gitlab.haskell.org/ghc/ghc/-/issues/22669
*.o-boot

# Local Netlify folder
.netlify
Loading