-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (83 loc) · 2.86 KB
/
ci.yml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
permissions:
contents: write
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
target: [desktop, web]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev
- name: Enable Developer Command Prompt (Windows)
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Setup CMake and Ninja
uses: lukka/get-cmake@latest
with:
useCloudCache: true
useLocalCache: false
cmakeVersion: "^3.24.0"
ninjaVersion: "^1.11.0"
- name: Setup Emscripten
if: matrix.target == 'web'
uses: mymindstorm/setup-emsdk@v14
with:
version: 3.1.51
- name: Export Emscripten environment
shell: bash
if: matrix.target == 'web' && matrix.os != 'windows-latest'
run: |
echo "EMSDK_ROOT=$EMSDK/upstream/emscripten" >> $GITHUB_ENV
echo "EMSDK_INCLUDE_ROOT=$EMSDK/upstream/emscripten/cache/sysroot/include" >> $GITHUB_ENV
- name: Export Emscripten environment (Windows)
if: matrix.target == 'web' && matrix.os == 'windows-latest'
run: |
echo "EMSDK_ROOT=$EMSDK/upstream/emscripten" >> $env:GITHUB_ENV
echo "EMSDK_INCLUDE_ROOT=$EMSDK/upstream/emscripten/cache/sysroot/include" >> $env:GITHUB_ENV
- name: Define compiler
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
echo "CXX=g++" >> $GITHUB_ENV
echo "CC=gcc" >> $GITHUB_ENV
elif [ "$RUNNER_OS" == "macOS" ]; then
echo "CXX=clang++" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
elif [ "$RUNNER_OS" == "Windows" ]; then
echo "CXX=cl" >> $GITHUB_ENV
echo "CC=cl" >> $GITHUB_ENV
else
echo "Unknown OS"
exit 1
fi
- name: Configure
shell: bash
run: cmake --preset=${{ matrix.target }}-release -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX
- name: Build
run: cmake --build ./build --target=all
- name: Copy WASM module (Ubuntu)
if: matrix.target == 'web' && matrix.os == 'ubuntu-latest'
run: |
cp ./build/sandbox.wasm ./src/web
cp ./build/sandbox.js ./src/web
cp ./build/sandbox.html ./src/web
- name: Deploy to GitHub Pages (Ubuntu)
if: matrix.target == 'web' && matrix.os == 'ubuntu-latest'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
branch: gh-pages
folder: src/web
clean: true