-
-
Notifications
You must be signed in to change notification settings - Fork 27
164 lines (143 loc) · 4.66 KB
/
ci.yml
File metadata and controls
164 lines (143 loc) · 4.66 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: CI
env:
VER_MAJOR: 26
VER_MINOR: 1
VER_PATCH: 3
LLVM_MINGW_VERSION: 20251216
on:
push:
branches: ["master", "stable/*"]
pull_request:
branches: ["master", "stable/*"]
merge_group:
types: [checks_requested]
workflow_call:
inputs:
nightly:
description: "Update all submodules to build nightly build"
default: true
required: true
type: boolean
outputs:
unsigned-artifact-id:
description: "Unsigned Installer"
value: ${{ jobs.package.outputs.unsigned-artifact-id }}
jobs:
build:
runs-on: ubuntu-latest
name: Build
steps:
- name: Cache llvm-mingw
id: cache-llvm-linux
uses: actions/cache@v5
with:
path: /opt/llvm-mingw
key: llvm-mingw-${{ runner.os }}-${{ env.LLVM_MINGW_VERSION }}
- name: Install llvm-mingw ${{ env.LLVM_MINGW_VERSION }}
if: steps.cache-llvm-linux.outputs.cache-hit != 'true'
run: |
mkdir -p /opt/llvm-mingw
cd /opt/llvm-mingw
curl -L https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_VERSION}/llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-ubuntu-22.04-x86_64.tar.xz | tar xJ --strip-components=1
- name: Setup llvm-mingw
run: |
echo "/opt/llvm-mingw/bin" >> $GITHUB_PATH
- name: Setup rust targets
run: |
rustup set auto-self-update disable
rustup target add i686-pc-windows-gnullvm
rustup target add x86_64-pc-windows-gnullvm
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install build dependencies
run: |
cargo install --locked chewing-cli
- uses: actions/checkout@v6
with:
submodules: true
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
editor/src-tauri
preferences/src-tauri
- name: Install NPM dependencies
run: |
cd preferences
npm install
cd ..
cd editor
npm install
cd ..
- name: Generate nightly version info
if: ${{ inputs.nightly }}
run: |
cargo xtask update-version --major $VER_MAJOR --minor $VER_MINOR --patch $VER_PATCH -b $GITHUB_RUN_NUMBER
cat version.rc
cat installer/version.wxi
- name: Generate pull_request version info
if: github.event_name == 'pull_request'
env:
PR_NUMBER: ${{ github.event.number }}
run: |
cargo xtask update-version --major 0 --minor 0 --patch $PR_NUMBER -b $GITHUB_RUN_NUMBER
cat version.rc
cat installer/version.wxi
- name: Build nightly
if: ${{ inputs.nightly || github.event_name == 'pull_request' }}
env:
# HACK: force embed-resource to use llvm-rc
RC: llvm-rc
run: |
cargo xtask build-installer --nightly --release --target gnullvm
- name: Build release
if: ${{ !inputs.nightly && github.event_name != 'pull_request' }}
env:
# HACK: force embed-resource to use llvm-rc
RC: llvm-rc
run: |
cargo xtask build-installer --release --target gnullvm
- uses: actions/upload-artifact@v6
with:
name: Installer Artifact With Debuginfo
path: build/installer
- name: Strip debug info
run: |
x86_64-w64-mingw32-strip build/installer/x64/chewing_tip.dll
i686-w64-mingw32-strip build/installer/x86/chewing_tip.dll
x86_64-w64-mingw32-strip build/installer/*.exe
- uses: actions/upload-artifact@v6
with:
name: Installer Artifact
path: build/installer
package:
runs-on: windows-latest
name: Package
outputs:
unsigned-artifact-id: ${{ steps.upload-unsigned.outputs.artifact-id }}
needs: [build]
steps:
- uses: actions/checkout@v6
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
# - name: Start SSH session
# uses: luchihoratiu/debug-via-ssh@main
# with:
# NGROK_AUTH_TOKEN: ${{ secrets.NGROK_TOKEN }}
# SSH_PASS: ${{ secrets.SSH_PASS }}
# NGROK_REGION: jp
- uses: Swatinem/rust-cache@v2
- name: Download Installer Artifact
uses: actions/download-artifact@v7
with:
name: Installer Artifact
path: build/installer
- name: Build Package
shell: cmd
run: |
cargo xtask package-installer
- id: upload-unsigned
uses: actions/upload-artifact@v6
with:
name: Unsigned Installer
path: |
dist\windows-chewing-tsf-unsigned.msi