diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a8ad23c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,36 @@ +name: Test + +on: + pull_request: + push: + branches: [main] + +# Cancel in-flight runs for the same ref when a new commit lands. +concurrency: + group: test-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + node-version: ['20', '22'] + steps: + - uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - run: npm ci + + - name: Build harness + run: npm run build:harness + + - name: Run tests + run: npm test diff --git a/package.json b/package.json index 7067049..74e56e1 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "build:harness": "tsc -p tsconfig.json", "harness": "npm run build:harness --silent && node ./dist/cli.js", "typecheck": "tsc -p tsconfig.app.json --noEmit", + "test": "node --test test/*.mjs", "parse-gtfs": "node scripts/parse-gtfs.mjs" }, "engines": {