diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 496e11c7..61aaf75c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - test: + build: strategy: fail-fast: false # prevent test to stop if one fails matrix: @@ -15,21 +15,28 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - uses: actions/cache@v3 - with: - path: ~/.pkg-cache/ - key: ${{ matrix.os }}-${{ matrix.node-version }} + cache: 'yarn' - run: yarn install - if: matrix['node-version'] == '18.x' && matrix['os'] == 'ubuntu-latest' run: yarn lint - run: yarn build - - run: yarn test - env: - CI: true - timeout-minutes: 30 + test_host: + uses: ./.github/workflows/test.yml + with: + npm_command: test:host + + test_18: + uses: ./.github/workflows/test.yml + with: + npm_command: test:18 + + test_20: + uses: ./.github/workflows/test.yml + with: + npm_command: test:20 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..d4a08d36 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,36 @@ +name: CI + +on: + workflow_call: + inputs: + npm_command: + description: 'NPM command to run' + type: string + required: true + default: 'install' +jobs: + test: + strategy: + fail-fast: false # prevent test to stop if one fails + matrix: + node-version: [18.x, 20.x] + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + - uses: actions/cache@v4 + with: + path: ~/.pkg-cache/ + key: ${{ matrix.os }}-${{ matrix.node-version }} + + - run: yarn install + + - run: yarn build + - run: yarn ${{ inputs.npm_command }} + env: + CI: true + timeout-minutes: 30 diff --git a/test/test-80-compression-node-opcua/main.js b/test/test-80-compression-node-opcua/main.js index 60a060f4..304beea7 100644 --- a/test/test-80-compression-node-opcua/main.js +++ b/test/test-80-compression-node-opcua/main.js @@ -14,6 +14,12 @@ const assert = require('assert'); const utils = require('../utils.js'); const pkgJson = require('./package.json'); +// FIXME: this test takes a long time to run (from 5min on linux up to 10 minuntes on windows) +// run only on linux to save time on CI +if (process.platform !== 'linux') { + return; +} + const isWindows = process.platform === 'win32'; const buildDir = 'build'; diff --git a/test/test.js b/test/test.js index 89dec105..820d2598 100644 --- a/test/test.js +++ b/test/test.js @@ -189,7 +189,6 @@ async function run() { } catch (error) { failed.push({ file, - error: error.message, output: error.logOutput, }); addLog( @@ -219,10 +218,9 @@ async function run() { console.log(`Ok: ${ok}`); console.log(`Failed: ${failed.length}`); // print failed tests - for (const { file, error, output } of failed) { + for (const { file, output } of failed) { console.log(''); console.log(`--- ${file} ---`); - console.log(pc.red(error)); console.log(pc.red(output)); } console.log(`Time: ${msToHumanDuration(end - start)}`);