Skip to content

Commit 39b33c9

Browse files
committed
Add WASM-based Ormolu Live
1 parent 591b589 commit 39b33c9

24 files changed

+13758
-20
lines changed

.github/workflows/ci.yml

+77
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,80 @@ jobs:
3838
- name: pre-commit-check
3939
run: |
4040
nix build -L .#pre-commit-check
41+
live-wasm:
42+
needs: lint
43+
name: Build Ormolu WASM
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v3
47+
- uses: cachix/install-nix-action@v18
48+
with:
49+
extra_nix_config: |
50+
accept-flake-config = true
51+
- uses: actions/cache@v3
52+
with:
53+
path: |
54+
~/.ghc-wasm/.cabal/store
55+
ormolu-live/dist-newstyle
56+
key: wasm-${{ github.run_id }}
57+
restore-keys: |
58+
wasm-${{ github.run_id }}
59+
wasm-
60+
- name: Build Ormolu WASM
61+
run: |
62+
cd ormolu-live
63+
nix develop .#ghcWasm -c sh -c \
64+
'wasm32-wasi-cabal update && ./build-wasm.sh -Oz'
65+
- uses: actions/upload-artifact@v3
66+
with:
67+
name: wasm
68+
path: ormolu-live/src/ormolu.wasm
69+
live-frontend:
70+
needs: lint
71+
name: Build Ormolu Live frontend
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v3
75+
- uses: cachix/install-nix-action@v18
76+
with:
77+
extra_nix_config: |
78+
accept-flake-config = true
79+
- name: Build frontend
80+
run: |
81+
nix build -L .#ormoluLive
82+
cp -r --no-preserve=mode,ownership result/ site
83+
- uses: actions/upload-artifact@v3
84+
with:
85+
name: frontend
86+
path: site/
87+
live-deploy:
88+
needs: [live-wasm, live-frontend]
89+
name: Deploy Ormolu Live
90+
runs-on: ubuntu-latest
91+
env:
92+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
93+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
94+
steps:
95+
- uses: actions/download-artifact@v3
96+
- name: Combine
97+
run: |
98+
cp wasm/ormolu.wasm frontend/ormolu.*.wasm
99+
- uses: geekyeggo/delete-artifact@v2
100+
with:
101+
name: |
102+
wasm
103+
frontend
104+
- name: Deploy to Netlify, preview
105+
if: env.NETLIFY_AUTH_TOKEN != ''
106+
uses: nwtgck/actions-netlify@v2
107+
with:
108+
publish-dir: ./frontend
109+
github-token: ${{ secrets.GITHUB_TOKEN }}
110+
alias: ${{ github.event.pull_request.head.sha || github.sha }}
111+
enable-pull-request-comment: true
112+
enable-commit-comment: false
113+
enable-commit-status: true
114+
- name: Deploy to Netlify, production
115+
if: env.NETLIFY_AUTH_TOKEN != '' && github.ref == 'refs/heads/master'
116+
run: |
117+
netlify deploy --prod -d ./frontend

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ result*
3232
# These are touched on every :reload in GHCi.
3333
# https://gitlab.haskell.org/ghc/ghc/-/issues/22669
3434
*.o-boot
35+
36+
# Local Netlify folder
37+
.netlify

0 commit comments

Comments
 (0)