Skip to content

Commit 92ddb0e

Browse files
authored
Init CI workflow for pull requests (#53)
1 parent 05dacd2 commit 92ddb0e

File tree

3 files changed

+103
-53
lines changed

3 files changed

+103
-53
lines changed

.github/actions/build/action.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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=./

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v6
17+
18+
- name: Build
19+
uses: ./.github/actions/build

.github/workflows/deploy.yml

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -24,60 +24,8 @@ jobs:
2424
- name: Checkout
2525
uses: actions/checkout@v6
2626

27-
- name: Checkout emsdk
28-
uses: actions/checkout@v6
29-
with:
30-
repository: emscripten-core/emsdk
31-
path: emsdk
32-
33-
- name: Restore build cache
34-
uses: actions/cache@v5
35-
with:
36-
path: |
37-
emsdk
38-
wasm/build
39-
wasm/luau
40-
public/wasm/luau.wasm
41-
src/lib/luau/luau-module.js
42-
key: build-${{ runner.os }}-${{ hashFiles('wasm/src/**', 'wasm/CMakeLists.txt', 'wasm/build.sh') }}-luau-${{ github.run_id }}
43-
restore-keys: |
44-
build-${{ runner.os }}-${{ hashFiles('wasm/src/**', 'wasm/CMakeLists.txt', 'wasm/build.sh') }}-luau-
45-
build-${{ runner.os }}-
46-
47-
- name: Install Emscripten
48-
run: |
49-
cd emsdk
50-
./emsdk install latest
51-
./emsdk activate latest
52-
53-
- name: Clone or update Luau
54-
run: |
55-
if [ ! -d "wasm/luau" ]; then
56-
git clone --depth 1 https://github.com/Roblox/luau.git wasm/luau
57-
else
58-
cd wasm/luau
59-
git fetch origin
60-
git diff --quiet HEAD FETCH_HEAD || git reset --hard FETCH_HEAD
61-
fi
62-
63-
- name: Build WASM
64-
run: |
65-
source emsdk/emsdk_env.sh
66-
cd wasm
67-
./build.sh release
68-
69-
- name: Setup Node.js
70-
uses: actions/setup-node@v6
71-
with:
72-
node-version: 24
73-
cache: npm
74-
75-
- name: Install dependencies
76-
run: npm ci
77-
7827
- name: Build
79-
# Use relative base so the same build works from any path (/ or /playground/)
80-
run: npx vite build --base=./
28+
uses: ./.github/actions/build
8129

8230
- name: Setup Pages
8331
uses: actions/configure-pages@v5

0 commit comments

Comments
 (0)