Skip to content

Commit

Permalink
ci: split CLI/Node tests (#3096)
Browse files Browse the repository at this point in the history
## Changes

Fixes
https://linear.app/nango/issue/NAN-2181/ci-split-all-cli-node-client-out-of-main-tests-suite

- Split CLI and node client tests and execute in a dedicated matrix 
They run 6 tests (Node 18, 20, 22 x windows or ubuntu). It's a lot but
seems relatively fast. Alternatively we could make windows matrix only
execute on master.
We could further optimize this and run them only types or node or cli
has changed but it's a pain to create this kind of logic.

- Integration and regular tests only run on Ubuntu + .nvmrc
This doesn't save much time since the matrix was running in parallel but
reduce potential for flaky tests
  • Loading branch information
bodinsamuel authored Dec 3, 2024
1 parent 58f2683 commit 5bd57b6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 62 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/tests-cli-windows.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test node client
name: Run Client Tests

on:
push:
Expand All @@ -8,16 +8,15 @@ on:
pull_request:
merge_group:

concurrency:
group: tests-node-client/${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
tests-node-client:
runs-on: ubuntu-latest
tests:
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x]
node-version: [18.x, 20.x, 22.x]
os: [ubuntu-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
Expand All @@ -30,21 +29,27 @@ jobs:
cache: 'npm'
node-version: ${{ matrix.node-version }}

- name: Build
- run: npm ci

- name: Build Typescript
run: npm run ts-build

- run: npm run test:cli
- run: npm run test:unit -- packages/cli

- name: Build Node Client
run: |
npm ci
npm run ts-build
pushd packages/node-client
npm run build
popd
npm run -w @nangohq/node build
- name: Test CJS
- name: Test Node CJS
shell: bash
run: |
RES=$(node packages/node-client/tests/built.cjs)
echo "$RES";
[ "$RES" != *"Done"* ] || { exit 1; }
- name: Test ESM
- name: Test Node ESM
shell: bash
run: |
RES=$(node packages/node-client/tests/built.js)
echo "$RES";
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,21 @@ concurrency:

jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [18.x, 20.x]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: ${{ matrix.node-version }}
node-version-file: '.nvmrc'

- run: npm ci
- run: npm run ts-build
- run: npm run test:unit
- run: npm run test:cli
- run: npm run test:unit -- --exclude packages/cli/
- run: npm run test:integration

0 comments on commit 5bd57b6

Please sign in to comment.