chore(deps)(deps): bump the github-actions group with 3 updates #853
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 | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| setup: | |
| name: Setup Matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| node-versions: ${{ steps.generate-matrix.outputs.node-versions }} | |
| latest-version: ${{ steps.generate-matrix.outputs.latest-version }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| - name: Generate Node.js version matrix | |
| id: generate-matrix | |
| run: | | |
| # Extract all Node.js major versions from package.json engines field | |
| # Supports format like "20 || 22 || 24" | |
| NODE_VERSIONS=$(node -p " | |
| const engines = require('./package.json').engines.node; | |
| engines.match(/\d+/g).map(v => v + '.x').join(' '); | |
| ") | |
| # Convert to array | |
| VERSIONS=($NODE_VERSIONS) | |
| # Convert to compact JSON array for matrix | |
| MATRIX_JSON=$(printf '%s\n' "${VERSIONS[@]}" | jq -R . | jq -sc .) | |
| echo "node-versions=$MATRIX_JSON" >> $GITHUB_OUTPUT | |
| # Set latest version for build job | |
| LATEST="${VERSIONS[-1]}" | |
| echo "latest-version=$LATEST" >> $GITHUB_OUTPUT | |
| echo "Testing on Node.js versions: ${VERSIONS[*]}" | |
| echo "Latest version for build: $LATEST" | |
| - name: Verify .nvmrc matches latest Node.js version | |
| run: | | |
| # Read .nvmrc | |
| if [ ! -f .nvmrc ]; then | |
| echo "❌ .nvmrc file not found!" | |
| exit 1 | |
| fi | |
| NVMRC_VERSION=$(cat .nvmrc | tr -d '[:space:]') | |
| echo "📋 .nvmrc version: $NVMRC_VERSION" | |
| # Get latest version from package.json (already extracted above) | |
| LATEST_VERSION=$(node -p " | |
| const engines = require('./package.json').engines.node; | |
| const versions = engines.match(/\d+/g); | |
| versions[versions.length - 1]; | |
| ") | |
| echo "📦 Latest package.json version: $LATEST_VERSION" | |
| # Compare versions | |
| if [ "$NVMRC_VERSION" != "$LATEST_VERSION" ]; then | |
| echo "❌ .nvmrc version ($NVMRC_VERSION) does not match latest package.json version ($LATEST_VERSION)!" | |
| echo "" | |
| echo "Please update .nvmrc to: $LATEST_VERSION" | |
| exit 1 | |
| fi | |
| echo "✅ .nvmrc matches latest package.json version ($LATEST_VERSION)" | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node-version: ${{ fromJson(needs.setup.outputs.node-versions) }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| # Disable cache for matrix builds to avoid conflicts between Node versions | |
| # Cache is still used in the build job | |
| # cache: 'npm' | |
| - name: Update npm (Node.js 20.x compatibility) | |
| if: matrix.node-version == '20.x' | |
| run: npm install -g npm@latest | |
| - name: Clean packages | |
| run: npm run clean | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint code | |
| run: npm run lint | |
| - name: Build packages | |
| run: npm run build | |
| - name: Run tests | |
| run: npm run test:ci | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5 | |
| if: success() | |
| with: | |
| files: ./coverage/lcov.info | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| compatibility: | |
| name: Package Compatibility | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| - name: Setup Node.js ${{ needs.setup.outputs.latest-version }} | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: ${{ needs.setup.outputs.latest-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build packages | |
| run: npm run build | |
| - name: Validate package exports with publint | |
| run: npm run validate:publint | |
| - name: Check TypeScript types with arethetypeswrong | |
| run: npm run validate:attw | |
| - name: Run compatibility examples | |
| run: cd examples && ./run-all.sh |