-
Notifications
You must be signed in to change notification settings - Fork 4.9k
178 lines (172 loc) · 5.73 KB
/
nodejs.yml
File metadata and controls
178 lines (172 loc) · 5.73 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Node CI
env:
DEBUG: napi:*
MACOSX_DEPLOYMENT_TARGET: '10.13'
on:
push:
branches:
- 'chore/**'
- 'feat/**'
- 'fix/**'
- '1.x'
- '2.x'
- '3.x'
- '4.x'
- main
pull_request:
branches:
- main
permissions:
contents: read # to fetch code (actions/checkout)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-rust-binding:
name: Build Rust Binding
uses: ./.github/workflows/build-rust-binding.yml
build-rust-wasm:
name: Build Rust WASM
uses: ./.github/workflows/build-rust-wasm.yml
nodejs-testing:
name: Testing on Node.js ${{ matrix.node-version }} (${{ matrix.host }})
needs:
- build-rust-binding
- build-rust-wasm
strategy:
matrix:
node-version: [18.x, 20.x]
host: [macos-latest, windows-latest, ubuntu-latest]
exclude:
- node-version: 18.x
host: macos-latest
- node-version: 18.x
host: windows-latest
- node-version: 20.x
host: macos-latest
- node-version: 20.x
host: windows-latest
include:
- host: macos-latest
target: x86_64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
runs-on: ${{ matrix.host }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm -r install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Download artifact bindings-${{ matrix.target }}
uses: actions/download-artifact@v6
with:
name: bindings-${{ matrix.target }}
path: crates/native_binding
- name: Test bindings
run: pnpm test:binding
if: ${{ matrix.host != 'ubuntu-latest' }}
- name: Test bindings with docker
if: ${{ matrix.host == 'ubuntu-latest' }}
# 暂时使用了一个第三方的 docker 镜像
run: docker run --rm -v $(pwd):/build -w /build chf007/pnpm pnpm test:binding
# 以下的测试流程应该在所有平台都执行,但 windows 好像还有些问题,因此目前只在 ubuntu-latest 执行
- name: Download all artifacts
uses: actions/download-artifact@v6
with:
path: crates/native_binding/artifacts
- name: List Package crates/native_binding
run: ls -R ./crates/native_binding
shell: bash
- name: Move artifacts
run: pnpm artifacts
- name: build
shell: bash
run: |
if [ "${{ matrix.host }}" = "windows-latest" ]; then
pnpm build:serial
else
pnpm build
fi
env:
NODE_OPTIONS: --max_old_space_size=4096
- name: test
#TODO: 需要优化测试流程,目前 macos 无法正常执行测试,暂时跳过,等待后续优化
shell: bash
run: |
if [ "${{ matrix.host }}" = "macos-latest" ]; then
pnpm -r --aggregate-output --filter=./packages/* --filter=./tests --filter=!@tarojs/components test:ci
else
pnpm test
fi
# 以下 coverage 流程通过 artifact 拆分文件作为单独 job 上传时间损耗过长,因此在在 node test 后直接继续执行
- name: Upload [taro-cli] coverage to Codecov
uses: codecov/codecov-action@v5
if: ${{ matrix.host == 'ubuntu-latest' }}
with:
flags: taro-cli
files: ./packages/taro-cli/coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload runner coverage to Codecov
uses: codecov/codecov-action@v5
if: ${{ matrix.host == 'ubuntu-latest' }}
with:
flags: taro-runner
files: ./packages/taro-webpack5-runner/coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload [taro-runtime] coverage to Codecov
uses: codecov/codecov-action@v5
if: ${{ matrix.host == 'ubuntu-latest' }}
with:
flags: taro-runtime
files: ./packages/taro-runtime/coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload [taro-web] coverage to Codecov
uses: codecov/codecov-action@v5
if: ${{ matrix.host == 'ubuntu-latest' }}
with:
flags: taro-web
files: ./packages/taro-components/coverage/clover.xml,./packages/taro-h5/coverage/clover.xml,./packages/taro-router/coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload rest coverage to Codecov
uses: codecov/codecov-action@v5
if: ${{ matrix.host == 'ubuntu-latest' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
rust-testing:
name: Testing on Rust
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: wasm32-wasip1
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
.cargo-cache
target/
key: wasm32-wasi-cargo-ubuntu-latest
- name: Test
run: cargo test-swc-plugins