db-vendo-client/.github/workflows/test.yml
McToel 1aeb246622
Browser compatibility (#17)
* Removed Proxy and local address code

* replaced node crypto with web crypto

* Replaced require with static imports

* removed commented out imports

* import db-hafas-stations on demand

* trying to handle undefined envs

* Less optimistic variable handling

* cleanup

* Small browser docs addition

* Linting

* No async in new Promise

* Bumped eslint to v9 and ecmaScript to 2025

* removed duplicated eslint config

* Bumped minimal node version to node 18

* Added node 24

* using math.random instead of webcrypto and reintroduced randomizeUserAgent

* Oh no node 24 is actually not released yet

* removed temp debug file
2025-02-25 13:21:26 +01:00

97 lines
2.2 KiB
YAML

name: test
on: [push, pull_request, workflow_call]
env:
npm_config_cache: /tmp/npm-cache
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: "Use Node.js"
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- run: npm install
- run: npm run lint
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 18.x
- 20.x
- 22.x
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup Node.js v${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- id: cache-npm
name: restore npm cache
uses: actions/cache@v4
with:
key: npm-cache-${{ github.ref_name }}-${{ matrix.node-version }}-unit-tests
path: ${{ env.npm_config_cache }}
- run: npm install
- run: npm run test-unit
integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 18.x
- 20.x
- 22.x
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup Node.js v${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- id: cache-npm
name: restore npm cache
uses: actions/cache@v4
with:
key: npm-cache-${{ github.ref_name }}-${{ matrix.node-version }}-integration-tests
path: ${{ env.npm_config_cache }}
- run: npm install
- run: npm run test-integration
e2e-tests:
needs: [unit-tests, integration-tests]
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup Node.js v${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- id: cache-npm
name: restore npm cache
uses: actions/cache@v4
with:
key: npm-cache-${{ github.ref_name }}-${{ matrix.node-version }}-e2e-tests
path: ${{ env.npm_config_cache }}
- run: npm install
- run: npm run test-e2e