|
| 1 | +name: "Build" |
| 2 | +description: "Build WASM, install dependencies, run tests, type-check, and build the app" |
| 3 | + |
| 4 | +runs: |
| 5 | + using: "composite" |
| 6 | + steps: |
| 7 | + - name: Checkout emsdk |
| 8 | + uses: actions/checkout@v6 |
| 9 | + with: |
| 10 | + repository: emscripten-core/emsdk |
| 11 | + path: emsdk |
| 12 | + |
| 13 | + - name: Get latest Luau release |
| 14 | + id: luau-release |
| 15 | + shell: bash |
| 16 | + run: | |
| 17 | + # Fetch the latest release tag from luau-lang/luau |
| 18 | + LATEST_TAG=$(curl -s https://api.github.com/repos/luau-lang/luau/releases/latest | jq -r '.tag_name') |
| 19 | + echo "Latest Luau release: $LATEST_TAG" |
| 20 | + echo "tag=$LATEST_TAG" >> "$GITHUB_OUTPUT" |
| 21 | +
|
| 22 | + # Fetch the commit hash for this tag |
| 23 | + COMMIT_HASH=$(curl -s https://api.github.com/repos/luau-lang/luau/git/ref/tags/$LATEST_TAG | jq -r '.object.sha') |
| 24 | + echo "Commit hash: $COMMIT_HASH" |
| 25 | + echo "commit=$COMMIT_HASH" >> "$GITHUB_OUTPUT" |
| 26 | +
|
| 27 | + - name: Restore build cache |
| 28 | + uses: actions/cache@v5 |
| 29 | + with: |
| 30 | + path: | |
| 31 | + emsdk |
| 32 | + wasm/build |
| 33 | + wasm/luau |
| 34 | + public/wasm/luau.wasm |
| 35 | + src/lib/luau/luau-module.js |
| 36 | + key: build-${{ runner.os }}-${{ hashFiles('wasm/src/**', 'wasm/CMakeLists.txt', 'wasm/build.sh') }}-luau-${{ steps.luau-release.outputs.commit }} |
| 37 | + restore-keys: | |
| 38 | + build-${{ runner.os }}-${{ hashFiles('wasm/src/**', 'wasm/CMakeLists.txt', 'wasm/build.sh') }}-luau- |
| 39 | + build-${{ runner.os }}- |
| 40 | +
|
| 41 | + - name: Install Emscripten |
| 42 | + shell: bash |
| 43 | + run: | |
| 44 | + cd emsdk |
| 45 | + ./emsdk install latest |
| 46 | + ./emsdk activate latest |
| 47 | +
|
| 48 | + - name: Clone or update Luau |
| 49 | + shell: bash |
| 50 | + run: | |
| 51 | + TAG=${{ steps.luau-release.outputs.tag }} |
| 52 | + if [ ! -d "wasm/luau" ]; then |
| 53 | + git clone --depth 1 --branch $TAG https://github.com/luau-lang/luau.git wasm/luau |
| 54 | + else |
| 55 | + cd wasm/luau |
| 56 | + git fetch origin $TAG |
| 57 | + git diff --quiet HEAD FETCH_HEAD || git reset --hard FETCH_HEAD |
| 58 | + fi |
| 59 | +
|
| 60 | + - name: Build WASM |
| 61 | + shell: bash |
| 62 | + run: | |
| 63 | + source emsdk/emsdk_env.sh |
| 64 | + cd wasm |
| 65 | + ./build.sh release |
| 66 | +
|
| 67 | + - name: Setup Node.js |
| 68 | + uses: actions/setup-node@v6 |
| 69 | + with: |
| 70 | + node-version: 24 |
| 71 | + cache: npm |
| 72 | + |
| 73 | + - name: Install dependencies |
| 74 | + shell: bash |
| 75 | + run: npm ci |
| 76 | + |
| 77 | + - name: Type check |
| 78 | + shell: bash |
| 79 | + run: npm run check |
| 80 | + |
| 81 | + - name: Build |
| 82 | + shell: bash |
| 83 | + run: npx vite build --base=./ |
0 commit comments