fix(ci): enable nontrapping wasm conversions #77
This file contains hidden or 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: Deploy Website | |
| on: | |
| push: | |
| branches: ['master'] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow one concurrent deployment | |
| concurrency: | |
| group: 'pages' | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version: '1.26' | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Build WASM compiler | |
| run: | | |
| GOOS=js GOARCH=wasm go build -ldflags="-s -w" -trimpath -o website/public/goscript.wasm ./cmd/goscript-wasm | |
| cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" website/public/ | |
| - name: Optimize WASM | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y binaryen | |
| wasm-opt --enable-bulk-memory --enable-nontrapping-float-to-int -Oz --strip-debug --strip-producers --strip-dwarf --zero-filled-memory website/public/goscript.wasm -o website/public/goscript.wasm | |
| - name: Build website data | |
| run: bun run website:build | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v6 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: website/dist | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |