diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a6b2368 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,50 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + verify: + name: Verify (Node ${{ matrix.node }}) + runs-on: ubuntu-latest + strategy: + matrix: + node: [22, 24] + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + cache: npm + + - run: npm ci + + - name: Typecheck + run: npm run typecheck + + - name: Lint + run: npm run lint + + - name: Format check + run: npm run format:check + + - name: Test + run: npm run test:coverage + + - name: Build + run: npm run build + + - name: Upload coverage + if: matrix.node == 22 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..49d64b6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release + +on: + push: + tags: + - "v*.*.*" + +permissions: + contents: read + id-token: write # required for npm provenance + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-node@v6 + with: + node-version: 24 + registry-url: https://registry.npmjs.org + package-manager-cache: false + + - run: npm ci + + - name: Typecheck + run: npm run typecheck + + - name: Lint + run: npm run lint + + - name: Test + run: npm run test:run + + - name: Verify tag matches package.json version + run: | + TAG_VERSION="${GITHUB_REF_NAME#v}" + PKG_VERSION=$(node -p "require('./package.json').version") + if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then + echo "Tag v$TAG_VERSION does not match package.json version $PKG_VERSION" + exit 1 + fi + + - name: Build + run: npm run build + + - name: Publish to npm + run: npm publish --access public diff --git a/src/react-router/__tests__/test-helpers.ts b/src/react-router/__tests__/test-helpers.ts index 15d26e5..3fdc3d8 100644 --- a/src/react-router/__tests__/test-helpers.ts +++ b/src/react-router/__tests__/test-helpers.ts @@ -7,7 +7,7 @@ const mockLocation: Location = { hash: "", state: null, key: "default", - unstable_mask: undefined + unstable_mask: undefined, }; /**