aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build_wasm.yml
blob: 92d974693c4b67c63c1dde48a544c7fde70cf9bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: nvim.wasm build

on:
  pull_request:
    branches:
      - 'master'
      - 'release-[0-9]+.[0-9]+'
    paths:
      - 'build.zig'
      - 'build.zig.zon'
      - '.github/scripts/build_wasm.sh'
      - '.github/workflows/build_wasm.yml'
  workflow_dispatch:

permissions:
  contents: read

jobs:
  build-wasm:
    name: Build nvim.wasm (Emscripten + Zig)
    runs-on: ubuntu-24.04
    timeout-minutes: 90

    steps:
      - name: Checkout
        uses: actions/checkout@v7
        with:
          persist-credentials: false

      - name: Set up Zig
        uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
        with:
          version: 0.16.0
          use-cache: false

      - name: Cache emsdk, Binaryen & build outputs
        uses: actions/cache@v6.1.0
        with:
          path: |
            ./.emsdk
            ./.binaryen
          key: ${{ runner.os }}-wasm-${{ hashFiles('build.zig', 'build.zig.zon', '.github/scripts/build_wasm.sh', '.github/workflows/build_wasm.yml') }}

      - name: Install system deps
        run: |
          sudo apt-get update
          sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
            python3 python3-pip curl unzip

      - name: Install Emscripten SDK
        run: |
          set -euo pipefail
          if [ ! -d ./.emsdk ]; then
            git clone https://github.com/emscripten-core/emsdk.git ./.emsdk
            cd ./.emsdk
            ./emsdk install 6.0.2
            ./emsdk activate 6.0.2
            cd -
          fi

      - name: Build nvim.wasm
        run: .github/scripts/build_wasm.sh