From cd3a850dcbf3599adb36bfa661eaab7dd9f03baf Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 19 Apr 2024 16:00:20 +0800 Subject: [PATCH] ci: improve test speed (#2057) --- .github/workflows/test-release.yaml | 13 ++++++++++--- examples/napi/__tests__/values.spec.ts | 4 ++++ examples/napi/__tests__/worker-thread.spec.ts | 3 ++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-release.yaml b/.github/workflows/test-release.yaml index 5486ad6b..f8411108 100644 --- a/.github/workflows/test-release.yaml +++ b/.github/workflows/test-release.yaml @@ -84,7 +84,7 @@ jobs: yarn test:macro toolchain: 1.65.0 - host: macos-14 - target: x86_64-apple-darwin + target: aarch64-apple-darwin build: yarn build:test test: | yarn test:cli @@ -150,7 +150,9 @@ jobs: - name: 'Install dependencies' 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 run: cargo check --target ${{ matrix.settings.target }} --all --bins --examples --tests -vvv @@ -171,7 +173,7 @@ jobs: run: ${{ matrix.settings.test }} - 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: | node ./node_modules/electron/install.js yarn test:electron @@ -403,6 +405,10 @@ jobs: args: '--platform linux/arm64' arch: 'arm64' libc: 'musl' + exclude: + - settings: + target: aarch64-unknown-linux-gnu + node: 18 steps: - uses: actions/checkout@v4 @@ -583,6 +589,7 @@ jobs: env: WASI_TEST: 'true' NODE_OPTIONS: '--max-old-space-size=8192' + SKIP_UNWIND_TEST: 1 - name: Browser test run: yarn workspace @examples/napi vitest diff --git a/examples/napi/__tests__/values.spec.ts b/examples/napi/__tests__/values.spec.ts index 12c2cc71..c3c805b1 100644 --- a/examples/napi/__tests__/values.spec.ts +++ b/examples/napi/__tests__/values.spec.ts @@ -811,11 +811,15 @@ test('async', async (t) => { t.is(name, '@examples/napi') await t.throwsAsync(() => readFileAsync('some_nonexist_path.file')) +}) +test('panic in async fn', async (t) => { if (!process.env.SKIP_UNWIND_TEST) { await t.throwsAsync(() => panicInAsync(), { message: 'panic in async function', }) + } else { + t.pass('no unwind runtime') } }) diff --git a/examples/napi/__tests__/worker-thread.spec.ts b/examples/napi/__tests__/worker-thread.spec.ts index 8aeb81b5..c5ec63d4 100644 --- a/examples/napi/__tests__/worker-thread.spec.ts +++ b/examples/napi/__tests__/worker-thread.spec.ts @@ -19,7 +19,8 @@ const concurrency = process.env.WASI_TEST (process.platform === 'linux' && process.arch === 'x64' && // @ts-expect-error - process?.report?.getReport()?.header?.glibcVersionRuntime) + process?.report?.getReport()?.header?.glibcVersionRuntime && + !process.env.ASAN_OPTIONS) ? 50 : 3