1
- # stolen from https://github.com/nvarner/typst-lsp /blob/master/.github/workflows/release.yml
1
+ # stolen from https://github.com/nvarner/tinymist /blob/master/.github/workflows/release.yml
2
2
name : CI
3
3
on :
4
4
push :
15
15
env :
16
16
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER : aarch64-linux-gnu-gcc
17
17
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER : arm-linux-gnueabihf-gcc
18
- SCCACHE_GHA_ENABLED : " true"
19
- RUSTC_WRAPPER : " sccache"
20
18
21
19
jobs :
22
20
pre_build :
40
38
rust-target : x86_64-pc-windows-msvc
41
39
platform : win32
42
40
arch : x64
41
+ regular_build : ' true'
43
42
- os : windows-latest
44
43
rust-target : aarch64-pc-windows-msvc
45
44
platform : win32
48
47
rust-target : x86_64-unknown-linux-gnu
49
48
platform : linux
50
49
arch : x64
50
+ regular_build : ' true'
51
51
- os : ubuntu-20.04
52
52
rust-target : aarch64-unknown-linux-gnu
53
53
platform : linux
@@ -56,134 +56,152 @@ jobs:
56
56
rust-target : arm-unknown-linux-gnueabihf
57
57
platform : linux
58
58
arch : armhf
59
- - os : macos-11
59
+ - os : macos-13
60
60
rust-target : x86_64-apple-darwin
61
61
platform : darwin
62
62
arch : x64
63
- - os : macos-11
63
+ - os : macos-13
64
64
rust-target : aarch64-apple-darwin
65
65
platform : darwin
66
66
arch : arm64
67
-
67
+ regular_build : ' true '
68
68
name : build (${{ matrix.platform }}-${{ matrix.arch }})
69
69
runs-on : ${{ matrix.os }}
70
70
env :
71
71
target : ${{ matrix.platform }}-${{ matrix.arch }}
72
72
steps :
73
73
- uses : actions/checkout@v4
74
74
with :
75
+ repository : Myriad-Dreamin/tinymist
75
76
submodules : recursive
76
- - name : Run sccache-cache
77
- uses :
mozilla-actions/[email protected]
77
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
78
78
- name : Install Node.js
79
79
uses : actions/setup-node@v4
80
80
with :
81
81
node-version : 16
82
- - name : Build typst-dom
82
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
83
+ - name : Install deps
84
+ run : yarn install
85
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
86
+ - name : Build typst-preview vscode extension
83
87
run : |
84
88
yarn
85
- yarn build
86
- working-directory : ./addons/typst-dom
87
- - name : Build frontend
88
- run : yarn
89
- working-directory : ./addons/frontend
90
- - name : Build vscode extension
89
+ yarn run compile
90
+ working-directory : ./contrib/typst-preview/editors/vscode
91
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
92
+ - name : Build tinymist vscode extension
91
93
run : |
92
94
yarn
93
95
yarn run compile
94
- working-directory : ./addons/vscode
96
+ working-directory : ./editors/vscode
97
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
95
98
- name : rust toolchain
96
99
uses : dtolnay/rust-toolchain@stable
97
100
with :
98
101
targets : ${{ matrix.rust-target }}
102
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
99
103
- name : Install llvm
100
- if : matrix.platform == 'linux'
104
+ if : matrix.platform == 'linux' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
101
105
run : |
102
106
sudo apt-get update
103
107
sudo apt-get install llvm
104
108
- name : Install AArch64 target toolchain
105
- if : matrix.rust-target == 'aarch64-unknown-linux-gnu'
109
+ if : matrix.rust-target == 'aarch64-unknown-linux-gnu' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
106
110
run : |
107
111
sudo apt-get update
108
112
sudo apt-get install gcc-aarch64-linux-gnu
109
113
- name : Install ARM target toolchain
110
- if : matrix.rust-target == 'arm-unknown-linux-gnueabihf'
114
+ if : matrix.rust-target == 'arm-unknown-linux-gnueabihf' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
111
115
run : |
112
116
sudo apt-get update
113
117
sudo apt-get install gcc-arm-linux-gnueabihf
114
- - name : Build typst-preview binary
118
+ - name : Run rust-cache
119
+ uses : Swatinem/rust-cache@v2
120
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
121
+ - name : Build tinymist binary
115
122
shell : pwsh
116
123
run : |
117
- cargo build --release -p typst-preview --target ${{ matrix.rust-target }}
124
+ cargo build --profile=gh-release -p tinymist --target ${{ matrix.rust-target }}
125
+ if : startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true'
118
126
- name : Rename debug symbols for windows
119
- if : matrix.platform == 'win32'
127
+ if : matrix.platform == 'win32' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
128
+ run : |
129
+ cd target/${{ matrix.rust-target }}/gh-release
130
+ cp tinymist.pdb tinymist-${{ env.target }}.pdb
131
+ - name : Split debug symbols for linux
132
+ if : matrix.platform == 'linux' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
120
133
run : |
121
- cd target/${{ matrix.rust-target }}/release
122
- cp typst_preview.pdb typst_preview-${{ env.target }}.pdb
134
+ cd target/${{ matrix.rust-target }}/gh-release
135
+ llvm-objcopy --compress-debug-sections --only-keep-debug "tinymist" "tinymist-${{ env.target }}.debug"
136
+ llvm-objcopy --strip-debug --add-gnu-debuglink="tinymist-${{ env.target }}.debug" "tinymist"
137
+ - name : Collect debug symbols for mac
138
+ if : matrix.platform == 'darwin' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
139
+ run : |
140
+ dsymutil -f "target/${{ matrix.rust-target }}/gh-release/tinymist"
141
+ mv "target/${{ matrix.rust-target }}/gh-release/tinymist.dwarf" "target/${{ matrix.rust-target }}/gh-release/tinymist-${{ env.target }}.dwarf"
142
+ - name : Copy binary to output directory
143
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
144
+ shell : pwsh
145
+ run : |
146
+ cp "target/${{ matrix.rust-target }}/gh-release/tinymist$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "editors/vscode/out/"
147
+ cp "target/${{ matrix.rust-target }}/gh-release/tinymist$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "contrib/typst-preview/editors/vscode/out/"
148
+ cp "target/${{ matrix.rust-target }}/gh-release/tinymist$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "tinymist-${{ env.target }}$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )"
149
+ - name : Test tinymist
150
+ run : |
151
+ cargo test --profile=gh-release --workspace --target ${{ matrix.rust-target }}
152
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') && (matrix.platform == 'linux') && (matrix.arch == 'x64')
123
153
- name : Upload split debug symbols for windows
124
- if : matrix.platform == 'win32'
154
+ if : matrix.platform == 'win32' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
125
155
uses : actions/upload-artifact@v4
126
156
with :
127
- name : typst_preview-${{ env.target }}.pdb
128
- path : target/${{ matrix.rust-target }}/release/typst_preview-${{ env.target }}.pdb
129
- - name : Split debug symbols for linux
130
- if : matrix.platform == 'linux'
131
- run : |
132
- cd target/${{ matrix.rust-target }}/release
133
- llvm-objcopy --compress-debug-sections --only-keep-debug "typst-preview" "typst-preview-${{ env.target }}.debug"
134
- llvm-objcopy --strip-debug --add-gnu-debuglink="typst-preview-${{ env.target }}.debug" "typst-preview"
157
+ name : tinymist-${{ env.target }}.pdb
158
+ path : target/${{ matrix.rust-target }}/gh-release/tinymist-${{ env.target }}.pdb
135
159
- name : Upload split debug symbols for linux
136
- if : matrix.platform == 'linux'
160
+ if : matrix.platform == 'linux' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
137
161
uses : actions/upload-artifact@v4
138
162
with :
139
- name : typst-preview -${{ env.target }}.debug
140
- path : target/${{ matrix.rust-target }}/release/typst-preview -${{ env.target }}.debug
163
+ name : tinymist -${{ env.target }}.debug
164
+ path : target/${{ matrix.rust-target }}/gh- release/tinymist -${{ env.target }}.debug
141
165
compression-level : 0
142
- - name : Collect debug symbols for mac
143
- if : matrix.platform == 'darwin'
144
- run : |
145
- dsymutil -f "target/${{ matrix.rust-target }}/release/typst-preview"
146
- mv "target/${{ matrix.rust-target }}/release/typst-preview.dwarf" "target/${{ matrix.rust-target }}/release/typst-preview-${{ env.target }}.dwarf"
147
166
- name : Upload split debug symbols for mac
148
- if : matrix.platform == 'darwin'
167
+ if : matrix.platform == 'darwin' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
149
168
uses : actions/upload-artifact@v4
150
169
with :
151
- name : typst-preview-${{ env.target }}.dwarf
152
- path : target/${{ matrix.rust-target }}/release/typst-preview-${{ env.target }}.dwarf
153
- - name : Copy binary to output directory
154
- shell : pwsh
155
- run : |
156
- cp "target/${{ matrix.rust-target }}/release/typst-preview$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "addons/vscode/out/"
157
- cp "target/${{ matrix.rust-target }}/release/typst-preview$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "typst-preview-${{ env.target }}$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )"
170
+ name : tinymist-${{ env.target }}.dwarf
171
+ path : target/${{ matrix.rust-target }}/gh-release/tinymist-${{ env.target }}.dwarf
158
172
- name : Upload binary artifact
173
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
159
174
uses : actions/upload-artifact@v4
160
175
with :
161
- name : typst-preview-${{ env.target }}
162
- path : typst-preview-${{ env.target }}${{ fromJSON('["", ".exe"]')[matrix.platform == 'win32'] }}
163
- - name : Package extension
176
+ name : tinymist-${{ env.target }}
177
+ path : tinymist-${{ env.target }}${{ fromJSON('["", ".exe"]')[matrix.platform == 'win32'] }}
178
+ - name : Package typst-preview extension
179
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
164
180
shell : pwsh
165
181
run : yarn run package -- --target ${{ env.target }} -o typst-preview-${{ env.target }}.vsix
166
- working-directory : ./addons/vscode
167
- - name : Upload VSIX artifact
182
+ working-directory : ./contrib/typst-preview/editors/vscode
183
+ - name : Package tinymist extension
184
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
185
+ shell : pwsh
186
+ run : yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix
187
+ working-directory : ./editors/vscode
188
+ - name : Upload typst-preview VSIX artifact
189
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
168
190
uses : actions/upload-artifact@v4
169
191
with :
170
192
name : typst-preview-${{ env.target }}.vsix
171
- path : addons/vscode/typst-preview-${{ env.target }}.vsix
172
- - name : Upload frontend html
193
+ path : contrib/typst-preview/editors/vscode/typst-preview-${{ env.target }}.vsix
194
+ - name : Upload VSIX artifact
195
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
173
196
uses : actions/upload-artifact@v4
174
- if : matrix.platform == 'linux' && matrix.arch == 'x64'
175
197
with :
176
- name : index.html
177
- path : addons/vscode/out/frontend/index.html
178
- overwrite : true
179
- - name : Publish crates
180
- if : matrix.platform == 'linux' && matrix.arch == 'x64' && startsWith(github.ref, 'refs/tags/')
181
- run : cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --allow-dirty
182
-
198
+ name : tinymist-${{ env.target }}.vsix
199
+ path : editors/vscode/tinymist-${{ env.target }}.vsix
183
200
184
201
build_alpine :
185
202
name : build (x86_64-unknown-linux-musl)
186
203
runs-on : ubuntu-latest
204
+ if : startsWith(github.ref, 'refs/tags/')
187
205
container :
188
206
image : rust:alpine
189
207
volumes :
@@ -199,52 +217,61 @@ jobs:
199
217
uses : actions/checkout@v4
200
218
with :
201
219
submodules : recursive
202
- - name : Run sccache-cache
203
- uses :
mozilla-actions/[email protected]
204
- - name : Build typst-dom
220
+ - name : Run rust-cache
221
+ uses : Swatinem/rust-cache@v2
222
+ - name : Install deps
223
+ run : yarn install
224
+ - name : Build typst-preview vscode extension
205
225
run : |
206
226
yarn
207
- yarn build
208
- working-directory : ./addons/typst-dom
209
- - name : Build frontend
210
- run : yarn
211
- working-directory : ./addons/frontend
212
- - name : Build vscode extension
227
+ yarn run compile
228
+ working-directory : ./contrib/typst-preview/editors/vscode
229
+ if : (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true')
230
+ - name : Build tinymist vscode extension
213
231
run : |
214
232
yarn
215
233
yarn run compile
216
- working-directory : ./addons /vscode
217
- - name : Build typst-preview binary
234
+ working-directory : ./editors /vscode
235
+ - name : Build tinymist binary
218
236
run : |
219
- cargo build --release -p typst-preview --target $RUST_TARGET
220
- mkdir -p addons/vscode/out
237
+ cargo build --profile=gh-release -p tinymist --target $RUST_TARGET
221
238
- name : Split debug symbols
222
239
run : |
223
- cd target/$RUST_TARGET/release
224
- objcopy --compress-debug-sections --only-keep-debug "typst-preview " "typst-preview -${{ env.target }}.debug"
225
- objcopy --strip-debug --add-gnu-debuglink="typst-preview- ${{ env.target }}.debug" "typst-preview "
240
+ cd target/$RUST_TARGET/gh- release
241
+ objcopy --compress-debug-sections --only-keep-debug "tinymist " "tinymist -${{ env.target }}.debug"
242
+ objcopy --strip-debug --add-gnu-debuglink="tinymist- ${{ env.target }}.debug" "tinymist "
226
243
- name : Upload split debug symbols
227
244
uses : actions/upload-artifact@v4
228
245
with :
229
- name : typst-preview -${{ env.target }}.debug
230
- path : target/${{ env.RUST_TARGET }}/release/typst-preview -${{ env.target }}.debug
246
+ name : tinymist -${{ env.target }}.debug
247
+ path : target/${{ env.RUST_TARGET }}/gh- release/tinymist -${{ env.target }}.debug
231
248
- name : Copy binary to output directory
232
249
run : |
233
- cp "target/${{ env.RUST_TARGET }}/release/typst-preview" "addons/vscode/out/"
234
- cp "target/${{ env.RUST_TARGET }}/release/typst-preview" "typst-preview-${{ env.target }}"
250
+ mkdir -p editors/vscode/out
251
+ cp "target/${{ env.RUST_TARGET }}/gh-release/tinymist" "editors/vscode/out/"
252
+ cp "target/${{ env.RUST_TARGET }}/gh-release/tinymist" "contrib/typst-preview/editors/vscode/out/"
253
+ cp "target/${{ env.RUST_TARGET }}/gh-release/tinymist" "tinymist-${{ env.target }}"
235
254
- name : Upload binary artifact
236
255
uses : actions/upload-artifact@v4
237
256
with :
238
- name : typst-preview -${{ env.target }}
239
- path : typst-preview -${{ env.target }}
240
- - name : Package extension
257
+ name : tinymist -${{ env.target }}
258
+ path : tinymist -${{ env.target }}
259
+ - name : Package typst-preview extension
241
260
run : yarn run package -- --target ${{ env.target }} -o typst-preview-${{ env.target }}.vsix
242
- working-directory : ./addons/vscode
243
- - name : Upload VSIX artifact
261
+ working-directory : ./contrib/typst-preview/editors/vscode
262
+ - name : Package extension
263
+ run : yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix
264
+ working-directory : ./editors/vscode
265
+ - name : Upload typst-preview VSIX artifact
244
266
uses : actions/upload-artifact@v4
245
267
with :
246
268
name : typst-preview-${{ env.target }}.vsix
247
- path : addons/vscode/typst-preview-${{ env.target }}.vsix
269
+ path : contrib/typst-preview/editors/vscode/typst-preview-${{ env.target }}.vsix
270
+ - name : Upload tinymist VSIX artifact
271
+ uses : actions/upload-artifact@v4
272
+ with :
273
+ name : tinymist-${{ env.target }}.vsix
274
+ path : editors/vscode/tinymist-${{ env.target }}.vsix
248
275
249
276
release :
250
277
runs-on : ubuntu-latest
@@ -270,21 +297,21 @@ jobs:
270
297
omitDraftDuringUpdate : true
271
298
omitNameDuringUpdate : true
272
299
omitPrereleaseDuringUpdate : true
273
- bodyFile : " addons/vscode/CHANGELOG.md"
274
300
275
301
publish :
276
302
runs-on : ubuntu-latest
277
303
needs : [build]
278
304
if : success() && startsWith(github.ref, 'refs/tags/')
279
305
steps :
280
306
- uses : actions/download-artifact@v4
281
-
307
+ - name : Install deps
308
+ run : yarn install
282
309
- name : Deploy to VS Code Marketplace
283
- run : npx vsce publish --packagePath $(find . -type f -iname '*.vsix')
310
+ run : npx @vscode/ vsce publish --packagePath $(find . -type f -iname 'typst-preview- *.vsix') --skip-duplicate
284
311
env :
285
312
VSCE_PAT : ${{ secrets.VSCODE_MARKETPLACE_TOKEN }}
286
313
287
314
- name : Deploy to OpenVSX
288
- run : npx ovsx publish --packagePath $(find . -type f -iname '*.vsix')
315
+ run : npx ovsx publish --packagePath $(find . -type f -iname 'typst-preview- *.vsix') --skip-duplicate
289
316
env :
290
317
OVSX_PAT : ${{ secrets.OPENVSX_ACCESS_TOKEN }}
0 commit comments