ci: improve test speed (#2057)

This commit is contained in:
LongYinan 2024-04-19 16:00:20 +08:00 committed by GitHub
parent 22c751ced0
commit cd3a850dcb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 4 deletions

View file

@ -84,7 +84,7 @@ jobs:
yarn test:macro yarn test:macro
toolchain: 1.65.0 toolchain: 1.65.0
- host: macos-14 - host: macos-14
target: x86_64-apple-darwin target: aarch64-apple-darwin
build: yarn build:test build: yarn build:test
test: | test: |
yarn test:cli yarn test:cli
@ -150,7 +150,9 @@ jobs:
- name: 'Install dependencies' - name: 'Install dependencies'
shell: bash shell: bash
run: yarn install --mode=skip-build --immutable run: |
yarn config set supportedArchitectures.cpu --json '["current", "x64", "x86"]'
yarn install --mode=skip-build --immutable
- name: Check build - name: Check build
run: cargo check --target ${{ matrix.settings.target }} --all --bins --examples --tests -vvv run: cargo check --target ${{ matrix.settings.target }} --all --bins --examples --tests -vvv
@ -171,7 +173,7 @@ jobs:
run: ${{ matrix.settings.test }} run: ${{ matrix.settings.test }}
- name: Electron tests - name: Electron tests
if: matrix.settings.target == 'x86_64-apple-darwin' || matrix.settings.target == 'x86_64-pc-windows-msvc' if: matrix.settings.target == 'aarch64-apple-darwin' || matrix.settings.target == 'x86_64-pc-windows-msvc'
run: | run: |
node ./node_modules/electron/install.js node ./node_modules/electron/install.js
yarn test:electron yarn test:electron
@ -403,6 +405,10 @@ jobs:
args: '--platform linux/arm64' args: '--platform linux/arm64'
arch: 'arm64' arch: 'arm64'
libc: 'musl' libc: 'musl'
exclude:
- settings:
target: aarch64-unknown-linux-gnu
node: 18
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -583,6 +589,7 @@ jobs:
env: env:
WASI_TEST: 'true' WASI_TEST: 'true'
NODE_OPTIONS: '--max-old-space-size=8192' NODE_OPTIONS: '--max-old-space-size=8192'
SKIP_UNWIND_TEST: 1
- name: Browser test - name: Browser test
run: yarn workspace @examples/napi vitest run: yarn workspace @examples/napi vitest

View file

@ -811,11 +811,15 @@ test('async', async (t) => {
t.is(name, '@examples/napi') t.is(name, '@examples/napi')
await t.throwsAsync(() => readFileAsync('some_nonexist_path.file')) await t.throwsAsync(() => readFileAsync('some_nonexist_path.file'))
})
test('panic in async fn', async (t) => {
if (!process.env.SKIP_UNWIND_TEST) { if (!process.env.SKIP_UNWIND_TEST) {
await t.throwsAsync(() => panicInAsync(), { await t.throwsAsync(() => panicInAsync(), {
message: 'panic in async function', message: 'panic in async function',
}) })
} else {
t.pass('no unwind runtime')
} }
}) })

View file

@ -19,7 +19,8 @@ const concurrency = process.env.WASI_TEST
(process.platform === 'linux' && (process.platform === 'linux' &&
process.arch === 'x64' && process.arch === 'x64' &&
// @ts-expect-error // @ts-expect-error
process?.report?.getReport()?.header?.glibcVersionRuntime) process?.report?.getReport()?.header?.glibcVersionRuntime &&
!process.env.ASAN_OPTIONS)
? 50 ? 50
: 3 : 3