diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e7a8f1934..bdbd07bd99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,18 @@ on: inputs: nodejs-version: description: 'Node.js version to use (e.g., 24.0.0-rc.1)' - required: true + required: false type: string + use-npm-registry: + description: 'Use npm registry (https://registry.npmjs.org/)' + required: false + type: boolean + default: false + runner-label: + description: 'Runner label to use for jobs' + required: false + type: string + default: 'tenki-standard-autoscale' # This allows a subsequently queued workflow run to interrupt previous runs concurrency: @@ -31,8 +41,8 @@ permissions: jobs: dependency-review: name: Dependency Review - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest + # if: github.event_name == 'pull_request' + runs-on: ${{ inputs.runner-label || 'tenki-standard-autoscale' }} permissions: contents: read steps: @@ -46,7 +56,7 @@ jobs: check-licenses: name: Check licenses - runs-on: ubuntu-latest + runs-on: ${{ inputs.runner-label || 'tenki-standard-autoscale' }} permissions: contents: read steps: @@ -57,7 +67,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v4 with: - node-version: 'lts/*' + node-version: ${{ inputs.nodejs-version || 'lts/*' }} cache: 'npm' cache-dependency-path: package.json check-latest: true @@ -65,6 +75,8 @@ jobs: - name: Install run: | npm install --ignore-scripts + env: + npm_config_registry: ${{ inputs.use-npm-registry && 'https://registry.npmjs.org/' || '' }} - name: Check licenses run: | @@ -72,7 +84,7 @@ jobs: lint: name: Lint - runs-on: ubuntu-latest + runs-on: ${{ inputs.runner-label || 'tenki-standard-autoscale' }} permissions: contents: read steps: @@ -83,7 +95,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v4 with: - node-version: 'lts/*' + node-version: ${{ inputs.nodejs-version || 'lts/*' }} cache: 'npm' cache-dependency-path: package.json check-latest: true @@ -91,7 +103,9 @@ jobs: - name: Install run: | npm install --ignore-scripts - + env: + npm_config_registry: ${{ inputs.use-npm-registry && 'https://registry.npmjs.org/' || '' }} + - name: Lint code run: | npm run lint @@ -102,6 +116,9 @@ jobs: permissions: contents: read uses: ./.github/workflows/coverage-nix.yml + with: + use-npm-registry: ${{ inputs.use-npm-registry || false }} + runner-label: ${{ inputs.runner-label || 'tenki-standard-autoscale' }} coverage-win: needs: @@ -109,6 +126,9 @@ jobs: permissions: contents: read uses: ./.github/workflows/coverage-win.yml + with: + use-npm-registry: ${{ inputs.use-npm-registry || false }} + runner-label: ${{ inputs.runner-label || 'tenki-standard-autoscale' }} test-unit: needs: @@ -122,7 +142,8 @@ jobs: strategy: matrix: node-version: [20, 22, 24] - os: [macos-latest, ubuntu-latest, windows-latest] + os: ['${{ inputs.runner-label || ''tenki-standard-autoscale'' }}'] + # os: [macos-latest, ${{ inputs.runner-label || 'tenki-standard-autoscale' }}, windows-latest] steps: - uses: actions/checkout@v4 @@ -140,6 +161,8 @@ jobs: - name: Install run: | npm install --ignore-scripts + env: + npm_config_registry: ${{ inputs.use-npm-registry && 'https://registry.npmjs.org/' || '' }} - name: Run tests run: | @@ -147,8 +170,9 @@ jobs: # Useful for testing Release Candidates of Node.js test-unit-custom: - if: github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest + # if: github.event_name == 'workflow_dispatch' + if: ${{ inputs.nodejs-version != '' }} + runs-on: ${{ inputs.runner-label || 'tenki-standard-autoscale' }} permissions: contents: read @@ -160,7 +184,7 @@ jobs: - name: Use Custom Node.js Version uses: actions/setup-node@v4 with: - node-version: ${{ github.event.inputs.nodejs-version }} + node-version: ${{ inputs.nodejs-version }} cache: 'npm' cache-dependency-path: package.json check-latest: true @@ -168,6 +192,8 @@ jobs: - name: Install run: | npm install --ignore-scripts + env: + npm_config_registry: ${{ inputs.use-npm-registry && 'https://registry.npmjs.org/' || '' }} - name: Run tests run: | @@ -178,7 +204,7 @@ jobs: - lint - coverage-nix - coverage-win - runs-on: 'ubuntu-latest' + runs-on: ${{ inputs.runner-label || 'tenki-standard-autoscale' }} permissions: contents: read @@ -197,6 +223,8 @@ jobs: - name: Install run: | npm install --ignore-scripts + env: + npm_config_registry: ${{ inputs.use-npm-registry && 'https://registry.npmjs.org/' || '' }} - name: Run typescript tests run: | @@ -208,7 +236,7 @@ jobs: needs: - test-typescript - test-unit - runs-on: ubuntu-latest + runs-on: ${{ inputs.runner-label || 'tenki-standard-autoscale' }} permissions: contents: read steps: @@ -218,40 +246,46 @@ jobs: - name: Use Node.js uses: actions/setup-node@v4 with: - node-version: 'lts/*' + node-version: ${{ inputs.nodejs-version || 'lts/*' }} cache: 'npm' cache-dependency-path: package.json check-latest: true - - name: install fastify + - name: Install run: | npm install --ignore-scripts + env: + npm_config_registry: ${{ inputs.use-npm-registry && 'https://registry.npmjs.org/' || '' }} - name: install webpack stack run: | cd test/bundler/webpack && npm install --ignore-scripts + env: + npm_config_registry: ${{ inputs.use-npm-registry && 'https://registry.npmjs.org/' || '' }} - name: Test webpack bundle run: | cd test/bundler/webpack && npm run test - name: install esbuild stack run: | cd test/bundler/esbuild && npm install --ignore-scripts + env: + npm_config_registry: ${{ inputs.use-npm-registry && 'https://registry.npmjs.org/' || '' }} - name: Test esbuild bundle run: | cd test/bundler/esbuild && npm run test - automerge: - if: > - github.event_name == 'pull_request' && - github.event.pull_request.head.repo.full_name == github.repository && - github.event.pull_request.user.login == 'dependabot[bot]' - needs: - - test-typescript - - test-unit - - package - runs-on: ubuntu-latest - permissions: - pull-requests: write - contents: write - steps: - - uses: fastify/github-action-merge-dependabot@v3 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} + # automerge: + # if: > + # github.event_name == 'pull_request' && + # github.event.pull_request.head.repo.full_name == github.repository && + # github.event.pull_request.user.login == 'dependabot[bot]' + # needs: + # - test-typescript + # - test-unit + # - package + # runs-on: ${{ inputs.runner-label || 'tenki-standard-autoscale' }} + # permissions: + # pull-requests: write + # contents: write + # steps: + # - uses: fastify/github-action-merge-dependabot@v3 + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }}