-
-
Notifications
You must be signed in to change notification settings - Fork 2
239 lines (203 loc) · 6.23 KB
/
swc4j_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
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
name: swc4j Build
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- "**.md"
- "docs/**"
push:
branches:
- main
paths-ignore:
- "**.md"
- "docs/**"
env:
SWC4J_VERSION: 1.3.0
jobs:
build_native:
strategy:
matrix:
include:
- image: windows-latest
os: windows
arch: x86_64
ext: .dll
- image: ubuntu-latest
os: linux
arch: x86_64
ext: .so
- image: macos-13
os: macos
arch: x86_64
ext: .dylib
- image: macos-14
os: macos
arch: arm64
ext: .dylib
name: Build swc4j for ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.image }}
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout the code
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x
- name: Cargo Build and Test
env:
RUSTFLAGS: -Awarnings
run: |
cd rust
cargo build -r
cargo test -r
deno run --allow-all ../scripts/ts/copy_swc4j_lib.ts -o ${{ matrix.os }} -a ${{ matrix.arch }}
- name: Setup JDK 8
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 8
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.10.2
- name: Build and Test
run: |
gradle build test generatePomFileForGeneratePomPublication --debug
- name: Upload the Artifact
uses: actions/upload-artifact@v4
with:
name: swc4j-${{ matrix.os }}-${{ matrix.arch }}-${{ env.SWC4J_VERSION }}
path: |
build/libs/swc4j-${{ env.SWC4J_VERSION }}.jar
build/libs/swc4j-${{ env.SWC4J_VERSION }}.pom
build_cross_platform:
strategy:
matrix:
include:
- image: windows-latest
os: windows
arch: arm64
ext: .dll
target: aarch64-pc-windows-msvc
command:
- image: ubuntu-latest
os: linux
arch: arm64
ext: .so
target: aarch64-unknown-linux-gnu
command: sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
name: Build swc4j for ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.image }}
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout the code
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x
- name: Cargo Build and Test
env:
RUSTFLAGS: -Awarnings
run: |
cd rust
${{ matrix.command }}
rustup target add ${{ matrix.target }}
cargo build -r --target ${{ matrix.target }}
deno run --allow-all ../scripts/ts/copy_swc4j_lib.ts -o ${{ matrix.os }} -a ${{ matrix.arch }}
- name: Setup JDK 8
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 8
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.10.2
- name: Build and Test
run: |
gradle build generatePomFileForGeneratePomPublication -x test --debug
- name: Upload the Artifact
uses: actions/upload-artifact@v4
with:
name: swc4j-${{ matrix.os }}-${{ matrix.arch }}-${{ env.SWC4J_VERSION }}
path: |
build/libs/swc4j-${{ env.SWC4J_VERSION }}.jar
build/libs/swc4j-${{ env.SWC4J_VERSION }}.pom
build_android:
name: Build swc4j for Android
runs-on: ubuntu-latest
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout the code
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Setup Android NDK
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: r27
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x
- name: Setup Cargo
env:
RUSTFLAGS: -Awarnings
run: |
cd rust
cargo install cargo-ndk
cargo ndk-env
rustup target add i686-linux-android
rustup target add x86_64-linux-android
rustup target add armv7-linux-androideabi
rustup target add aarch64-linux-android
- name: Cargo Build and Test
env:
RUSTFLAGS: -Awarnings
run: |
cd rust
cargo ndk --target i686-linux-android build --release && deno run --allow-all ../scripts/ts/copy_swc4j_lib.ts -o android -a x86
cargo ndk --target x86_64-linux-android build --release && deno run --allow-all ../scripts/ts/copy_swc4j_lib.ts -o android -a x86_64
cargo ndk --target armv7-linux-androideabi build --release && deno run --allow-all ../scripts/ts/copy_swc4j_lib.ts -o android -a arm
cargo ndk --target aarch64-linux-android build --release && deno run --allow-all ../scripts/ts/copy_swc4j_lib.ts -o android -a arm64
- name: Setup JDK 8
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 8
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.10.2
- name: Build and Test
run: |
gradle build generatePomFileForGeneratePomPublication -x test --debug
- name: Upload the Artifact
uses: actions/upload-artifact@v4
with:
name: swc4j-android-${{ env.SWC4J_VERSION }}
path: |
build/libs/swc4j-${{ env.SWC4J_VERSION }}.jar
build/libs/swc4j-${{ env.SWC4J_VERSION }}.pom