-
Notifications
You must be signed in to change notification settings - Fork 22
254 lines (230 loc) · 9.35 KB
/
test-cross-use.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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
name: test-cross-use
on:
workflow_dispatch:
inputs:
version:
description: '版本号'
required: true
default: '7.0.0-beta-9'
dryRun:
description: '测试写这个为 true'
required: true
default: 'false'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
base:
name: Test - ${{ matrix.platform.os-name }}
strategy:
fail-fast: false
matrix:
platform:
- os-name: x86_64-unknown-linux-gnu
runs-on: ubuntu-24.04
target: x86_64-unknown-linux-gnu
- os-name: Windows-x86_64-msvc
runs-on: windows-latest
target: x86_64-pc-windows-msvc
- os-name: macOS-x86_64
runs-on: macos-13
target: x86_64-apple-darwin
- os-name: macOS-aarch64
runs-on: macOS-latest
target: aarch64-apple-darwin
# more targets here ...
env:
TZ: Asia/Shanghai
runs-on: ${{ matrix.platform.runs-on }}
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: |
npm install cn-font-split -g
cn-font-split ls
- name: Create index.mjs file Linux
if: ${{ runner.os != 'Windows' }}
run: |
cat > index.mjs <<EOL
import unzipper from "unzipper";
fetch(
"https://github.com/atelier-anchor/smiley-sans/releases/download/v2.0.1/smiley-sans-v2.0.1.zip"
)
.then((res) => res.arrayBuffer())
.then(async (res) => {
const directory = await unzipper.Open.buffer(Buffer.from(res));
await directory.extract({ path: "./" });
});
EOL
- name: Create index.mjs file Windows
if: ${{ runner.os == 'Windows' }}
run: |
$content = @'
import unzipper from "unzipper";
fetch(
"https://github.com/atelier-anchor/smiley-sans/releases/download/v2.0.1/smiley-sans-v2.0.1.zip"
)
.then((res) => res.arrayBuffer())
.then(async (res) => {
const directory = await unzipper.Open.buffer(Buffer.from(res));
await directory.extract({ path: "./" });
});
'@
Set-Content -Path index.mjs -Value $content
- name: Install unzipper
run: |
npm init -y
npm install unzipper
node index.mjs
- name: build
run: |
cn-font-split -i ./SmileySans-Oblique.otf -o ./dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: test-${{ matrix.platform.target }}-${{hashFiles('dist/**/*.woff2')}}
path: ./dist/**/*
if-no-files-found: error
nodejs:
name: Test - ${{ matrix.platform.name }}
strategy:
fail-fast: false
matrix:
platform:
- name: aarch64-unknown-linux-gnu-ubuntu_latest
arch: aarch64
distro: ubuntu_latest
env:
TZ: Asia/Shanghai
runs-on: ubuntu-24.04
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: Create index.mjs file
run: |
cat > index.mjs <<EOL
import unzipper from "unzipper";
fetch(
"https://github.com/atelier-anchor/smiley-sans/releases/download/v2.0.1/smiley-sans-v2.0.1.zip"
)
.then((res) => res.arrayBuffer())
.then(async (res) => {
const directory = await unzipper.Open.buffer(Buffer.from(res));
await directory.extract({ path: "./" });
});
EOL
- name: Install unzipper
run: |
npm init -y
npm install unzipper
node index.mjs
- name: Build artifact
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.platform.arch }}
distro: ${{ matrix.platform.distro }}
# Not required, but speeds up builds
githubToken: ${{ github.token }}
dockerRunArgs: |
--volume "${PWD}/:/app"
# The shell to run commands with in the container
shell: /bin/sh
install: |
case "${{ matrix.platform.distro }}" in
ubuntu*|jessie|stretch|buster|bullseye)
apt-get update -q -y
apt-get install -q -y nodejs npm
;;
fedora*)
dnf -y update
dnf -y install nodejs which
;;
alpine*)
apk update
apk add nodejs
;;
esac
# Produce a binary artifact and place it in the mounted volume
run: |
npm i cn-font-split -g
cn-font-split ls
cn-font-split -i ./SmileySans-Oblique.otf -o ./dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: test-${{ matrix.platform.name }}-${{hashFiles('dist/**/*.woff2')}}
path: ./dist/**/*
if-no-files-found: error
python:
name: Test - ${{ matrix.platform.name }}
strategy:
fail-fast: false
matrix:
platform:
- name: aarch64-unknown-linux-gnu-bookworm
arch: aarch64
distro: bookworm
target: aarch64-unknown-linux-gnu
# - name: aarch64-unknown-linux-gnu-ubuntu22.04
# arch: aarch64
# distro: ubuntu22.04
# target: aarch64-unknown-linux-gnu
- name: riscv64gc-unknown-linux-gnu
arch: riscv64
distro: ubuntu_latest
target: riscv64gc-unknown-linux-gnu
- name: s390x-unknown-linux-gnu
arch: s390x
distro: ubuntu_latest
target: s390x-unknown-linux-gnu
# more targets here ...
env:
TZ: Asia/Shanghai
runs-on: ubuntu-24.04
steps:
- name: Build artifact
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.platform.arch }}
distro: ${{ matrix.platform.distro }}
# Not required, but speeds up builds
githubToken: ${{ github.token }}
dockerRunArgs: |
--volume "${PWD}/:/app"
# The shell to run commands with in the container
shell: /bin/sh
install: |
case "${{ matrix.platform.distro }}" in
ubuntu*|jessie|stretch|buster|bullseye)
apt-get update -q -y
apt-get install -q -y nodejs npm
;;
fedora*)
dnf -y update
dnf -y install nodejs which
;;
alpine*)
apk update
apk add nodejs
;;
esac
# Produce a binary artifact and place it in the mounted volume
run: |
apt update -y -q
apt install python3 python3-pip -y -q
pip3 install cn-font-split --break-system-packages
cn-font-split-py --install ${{ matrix.platform.target }}@${{inputs.version}}
cn-font-split-py -i ./SmileySans-Oblique.otf -o ./dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: test-${{ matrix.platform.name }}-${{hashFiles('dist/**/*.woff2')}}
path: ./dist/**/*
if-no-files-found: error