diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0513a16..30eef4f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,26 @@ on: pull_request: branches: [main, develop] +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + jobs: + dependency-review: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@v6 + - uses: actions/dependency-review-action@v4 + with: + fail-on-severity: high + audit: runs-on: ubuntu-latest steps: @@ -50,9 +69,19 @@ jobs: else npm run test:coverage fi + - name: Upload coverage + if: matrix.node-version == 22 + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + - name: Coverage report on PR + if: matrix.node-version == 22 && github.event_name == 'pull_request' + uses: davelosert/vitest-coverage-report-action@v2 - run: npx tsc --noEmit bench: + needs: [test] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -76,7 +105,7 @@ jobs: run: npm run test:e2e publish: - needs: [audit, lint, test, e2e] + needs: [audit, lint, test, bench, e2e] if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest permissions: @@ -100,9 +129,15 @@ jobs: exit 1 fi + - name: Validate changelog entry + run: | + TAG_VERSION="${GITHUB_REF_NAME#v}" + if ! grep -q "## \[${TAG_VERSION}\]" CHANGELOG.md; then + echo "::error::No CHANGELOG.md entry found for version ${TAG_VERSION}" + exit 1 + fi + - run: npm publish --provenance --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} - name: Extract release notes id: release_notes diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..65b9645 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,27 @@ +name: CodeQL + +on: + push: + branches: [main, develop] + pull_request: + branches: [main, develop] + schedule: + - cron: '0 6 * * 1' + +jobs: + analyze: + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + steps: + - uses: actions/checkout@v6 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: javascript-typescript + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3