-
Notifications
You must be signed in to change notification settings - Fork 34
96 lines (93 loc) · 2.74 KB
/
build.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
name: build
on:
workflow_call:
inputs:
os:
required: true
type: string
jobs:
build:
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v4
- name: Install Ubuntu dependencies
if: ${{ inputs.os == 'ubuntu-latest' }}
# no need to use clang if gcc 12 becomes default
run: |
sudo apt install -y ninja-build \
clang-format \
libboost-dev \
libboost-regex-dev \
libyaml-cpp-dev \
libleveldb-dev \
libmarisa-dev \
libopencc-dev
echo "CC=/usr/bin/clang" >> $GITHUB_ENV
echo "CXX=/usr/bin/clang++" >> $GITHUB_ENV
- name: Install macOS dependencies
if: ${{ startsWith(inputs.os, 'macos') }}
run: |
brew install ninja clang-format
- name: Install Windows dependencies
if: ${{ inputs.os == 'windows-latest' }}
run: |
choco upgrade -y llvm
pip install ninja
echo "$env:ProgramFiles\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Use Node.js latest
uses: actions/setup-node@v3
with:
node-version: 21.x
- name: Install node dependencies
run: |
npm i -g pnpm
pnpm i
- name: Get submodules
run: |
pnpm run submodule
- name: Get font
run: |
pnpm run font
- name: Run lint
run: |
pnpm run lint
- name: Install emsdk
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
- name: Build native librime
run: pnpm run native
- name: Install schemas
run: pnpm run schema
- name: Build wasm (Windows)
if: ${{ inputs.os == 'windows-latest' }}
run: |
emsdk/emsdk_env
pnpm run lib
pnpm run wasm
- name: Build wasm (POSIX)
if: ${{ inputs.os != 'windows-latest' }}
run: |
. emsdk/emsdk_env.sh
pnpm run lib
pnpm run wasm
- name: Check wasm reproducibility
run: |
pnpm run checksum
- name: Build
run: |
pnpm run build
- name: Tar files
if: ${{ inputs.os == 'ubuntu-latest' }}
run: tar --exclude=build/librime_native/bin/build -cvf artifact.tar build/librime_native/bin dist
- name: Upload artifact
if: ${{ inputs.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: artifact.tar
path: artifact.tar
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3