fix: resolve Dependabot security alerts and migrate to ESLint v9 #155
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: [ main ] | |
| release: | |
| types: [ published ] | |
| permissions: | |
| contents: write # Required for semantic-release to push tags and create releases | |
| issues: write # Required for semantic-release to create failure issues | |
| id-token: write # Required for npm provenance attestation | |
| env: | |
| NODE_VERSION: '22' | |
| jobs: | |
| test: | |
| name: Test (${{ matrix.server.name }}, Node ${{ matrix.node-version }}) | |
| runs-on: ubuntu-latest | |
| services: | |
| redis-server: | |
| image: ${{ matrix.server.image }} | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "${{ matrix.server.health-cmd }}" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| strategy: | |
| matrix: | |
| node-version: [22.x, 23.x] | |
| server: | |
| - name: redis | |
| image: redis:7-alpine | |
| health-cmd: redis-cli ping | |
| - name: valkey | |
| image: valkey/valkey:8-alpine | |
| health-cmd: valkey-cli ping | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Type check | |
| run: npm run type-check | |
| - name: Lint | |
| run: npm run lint | |
| - name: Format check | |
| run: npm run format:check | |
| - name: Build | |
| run: npm run build | |
| - name: Test - Unit | |
| run: npm run test | |
| - name: Test - Integration & E2E | |
| run: npm run test:integration | |
| env: | |
| NODE_ENV: test | |
| TEST_SERVER: ${{ matrix.server.name }} | |
| VALKEY_HOST: localhost | |
| VALKEY_PORT: 6379 | |
| - name: Test - Coverage | |
| run: npm run test:coverage | |
| if: matrix.node-version == '22.x' && matrix.server.name == 'redis' | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| if: matrix.node-version == '22.x' && matrix.server.name == 'redis' | |
| with: | |
| fail_ci_if_error: false | |
| test-logger-compatibility: | |
| name: Logger Compatibility Tests | |
| runs-on: ubuntu-latest | |
| services: | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| strategy: | |
| matrix: | |
| logger: [winston, pino, bunyan] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install ${{ matrix.logger }} | |
| run: npm install --no-save ${{ matrix.logger }} | |
| - name: Install pino-pretty (for Pino) | |
| if: matrix.logger == 'pino' | |
| run: npm install --no-save pino-pretty | |
| - name: Build | |
| run: npm run build | |
| - name: Test - Logger Integration (${{ matrix.logger }}) | |
| run: npm run test:integration | |
| env: | |
| NODE_ENV: test | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: [test, test-logger-compatibility] | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Configure NPM Authentication | |
| run: | | |
| echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
| echo "registry=https://registry.npmjs.org/" >> ~/.npmrc | |
| - name: Release | |
| run: npm run release | |
| env: | |
| GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_CONFIG_PROVENANCE: true | |
| docs: | |
| name: Deploy Documentation | |
| runs-on: ubuntu-latest | |
| needs: [test, test-logger-compatibility] | |
| if: github.event_name == 'release' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build documentation | |
| run: npm run docs | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs | |
| cname: redlock-universal.dev |