From 05d3c0bd5365e77b8e8acd3f61a42f44c4ad6aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCrg=C3=BCn=20Day=C4=B1o=C4=9Flu?= Date: Tue, 23 Apr 2024 10:35:29 +0200 Subject: [PATCH] Make node versions dynamic (#124) * use default node versions * add to other workflows * spacing * remove os matrix when it's not used * spacing * only test package managers on ubuntu, as is the case with fastify/fastify * update readme * update desc * remove stringified * don't add matrix is to benchmark --- .github/workflows/plugins-benchmark-pr.yml | 11 ++++++++--- .github/workflows/plugins-ci-kafka.yml | 7 ++++++- .github/workflows/plugins-ci-mongo.yml | 11 +++++++---- .github/workflows/plugins-ci-mysql.yml | 11 +++++++---- .github/workflows/plugins-ci-package-manager.yml | 10 ++++++++-- .github/workflows/plugins-ci-postgres.yml | 11 +++++++---- .github/workflows/plugins-ci-redis.yml | 7 ++++++- .github/workflows/plugins-ci.yml | 7 ++++++- README.md | 13 +++++++------ 9 files changed, 62 insertions(+), 26 deletions(-) diff --git a/.github/workflows/plugins-benchmark-pr.yml b/.github/workflows/plugins-benchmark-pr.yml index cdaddb9..bb948d5 100644 --- a/.github/workflows/plugins-benchmark-pr.yml +++ b/.github/workflows/plugins-benchmark-pr.yml @@ -31,6 +31,12 @@ on: type: string default: ${{ github.event.pull_request.base.ref }} required: false + node-versions: + description: 'A JSON array that specifies the Node.js versions on which the job should run.' + required: false + default: '["18", "20", "21"]' + type: string + jobs: benchmark: if: ${{ github.event.label.name == 'benchmark' }} @@ -47,7 +53,7 @@ jobs: strategy: matrix: - node-version: [18, 20, 21] + node-version: ${{ fromJson(inputs.node-versions) }} steps: - name: Checkout ${{ inputs.pr-repo }}@${{ inputs.pr-ref }} uses: actions/checkout@v4 @@ -90,8 +96,7 @@ jobs: echo 'EOF' >> $GITHUB_OUTPUT output-benchmark: - needs: - - benchmark + needs: benchmark runs-on: ubuntu-latest permissions: pull-requests: write diff --git a/.github/workflows/plugins-ci-kafka.yml b/.github/workflows/plugins-ci-kafka.yml index 2a3659a..11eb915 100644 --- a/.github/workflows/plugins-ci-kafka.yml +++ b/.github/workflows/plugins-ci-kafka.yml @@ -23,6 +23,11 @@ on: required: false default: false type: boolean + node-versions: + description: 'A JSON array that specifies the Node.js versions on which the job should run.' + required: false + default: '["18", "20", "21"]' + type: string jobs: dependency-review: @@ -96,7 +101,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [18, 20, 21] + node-version: ${{ fromJson(inputs.node-versions) }} services: zookeeper: image: 'confluentinc/cp-zookeeper:7.4.3' diff --git a/.github/workflows/plugins-ci-mongo.yml b/.github/workflows/plugins-ci-mongo.yml index 73c08b7..f9256a5 100644 --- a/.github/workflows/plugins-ci-mongo.yml +++ b/.github/workflows/plugins-ci-mongo.yml @@ -23,6 +23,11 @@ on: required: false default: false type: boolean + node-versions: + description: 'A JSON array that specifies the Node.js versions on which the job should run.' + required: false + default: '["18", "20", "21"]' + type: string jobs: dependency-review: @@ -93,15 +98,13 @@ jobs: test: name: Node.js ${{ matrix.node-version }} - ${{ matrix.db }} - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest permissions: contents: read strategy: matrix: - node-version: [18, 20, 21] - os: [ubuntu-latest] + node-version: ${{ fromJson(inputs.node-versions) }} db: [5] - services: mongo: image: mongo:${{ matrix.db }} diff --git a/.github/workflows/plugins-ci-mysql.yml b/.github/workflows/plugins-ci-mysql.yml index 96a490a..160bf2d 100644 --- a/.github/workflows/plugins-ci-mysql.yml +++ b/.github/workflows/plugins-ci-mysql.yml @@ -23,6 +23,11 @@ on: required: false default: false type: boolean + node-versions: + description: 'A JSON array that specifies the Node.js versions on which the job should run.' + required: false + default: '["18", "20", "21"]' + type: string jobs: dependency-review: @@ -95,15 +100,13 @@ jobs: test: name: Node.js ${{ matrix.node-version }} - ${{ matrix.db }} - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest permissions: contents: read strategy: matrix: - node-version: [18, 20, 21] - os: [ubuntu-latest] + node-version: ${{ fromJson(inputs.node-versions) }} db: ['mysql:8.0'] - services: mysql: image: ${{ matrix.db }} diff --git a/.github/workflows/plugins-ci-package-manager.yml b/.github/workflows/plugins-ci-package-manager.yml index 252b556..6bcc6d9 100644 --- a/.github/workflows/plugins-ci-package-manager.yml +++ b/.github/workflows/plugins-ci-package-manager.yml @@ -2,6 +2,12 @@ name: Plugin CI - Package Managers on: workflow_call: + inputs: + node-versions: + description: 'A JSON array that specifies the Node.js versions on which the job should run.' + required: false + default: '["18", "20", "21"]' + type: string jobs: pnpm: @@ -11,7 +17,7 @@ jobs: contents: read strategy: matrix: - node-version: [18, 20, 21] + node-version: ${{ fromJson(inputs.node-versions) }} os: [ubuntu-latest] pnpm-version: [8] @@ -44,7 +50,7 @@ jobs: contents: read strategy: matrix: - node-version: [18, 20, 21] + node-version: ${{ fromJson(inputs.node-versions) }} os: [ubuntu-latest] steps: - name: Check out repo diff --git a/.github/workflows/plugins-ci-postgres.yml b/.github/workflows/plugins-ci-postgres.yml index d0efb8a..6b3a316 100644 --- a/.github/workflows/plugins-ci-postgres.yml +++ b/.github/workflows/plugins-ci-postgres.yml @@ -23,6 +23,11 @@ on: required: false default: false type: boolean + node-versions: + description: 'A JSON array that specifies the Node.js versions on which the job should run.' + required: false + default: '["18", "20", "21"]' + type: string jobs: dependency-review: @@ -93,15 +98,13 @@ jobs: test: name: Node.js ${{ matrix.node-version }} - ${{ matrix.db }} - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest permissions: contents: read strategy: matrix: - node-version: [18, 20, 21] - os: [ubuntu-latest] + node-version: ${{ fromJson(inputs.node-versions) }} db: ['postgres:11-alpine'] - services: postgres: image: ${{ matrix.db }} diff --git a/.github/workflows/plugins-ci-redis.yml b/.github/workflows/plugins-ci-redis.yml index af77b25..3573da7 100644 --- a/.github/workflows/plugins-ci-redis.yml +++ b/.github/workflows/plugins-ci-redis.yml @@ -23,6 +23,11 @@ on: required: false default: false type: boolean + node-versions: + description: 'A JSON array that specifies the Node.js versions on which the job should run.' + required: false + default: '["18", "20", "21"]' + type: string jobs: dependency-review: @@ -96,7 +101,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [18, 20, 21] + node-version: ${{ fromJson(inputs.node-versions) }} db: [5, 6, 7] services: redis: diff --git a/.github/workflows/plugins-ci.yml b/.github/workflows/plugins-ci.yml index 28f47b8..2b621bb 100644 --- a/.github/workflows/plugins-ci.yml +++ b/.github/workflows/plugins-ci.yml @@ -28,6 +28,11 @@ on: required: false default: false type: boolean + node-versions: + description: 'A JSON array that specifies the Node.js versions on which the job should run.' + required: false + default: '["18", "20", "21"]' + type: string jobs: dependency-review: @@ -103,7 +108,7 @@ jobs: contents: read strategy: matrix: - node-version: [18, 20, 21] + node-version: ${{ fromJson(inputs.node-versions) }} os: [macos-latest, ubuntu-latest, windows-latest] steps: - name: Check out repo diff --git a/README.md b/README.md index e339b21..ee60ed9 100644 --- a/README.md +++ b/README.md @@ -64,10 +64,11 @@ jobs: | Input Name | Required | Type | Default | Description | | ---------------------------------- | ---------- | ------- | --------- | ---------------------------------------------------------------------------------- | -| `auto-merge-exclude` | false | string | `fastify` | Provide a semicolon separated list of packages that you do not want to be auto-merged. | -| `license-check` | false | boolean | `false` | Set to `true` to check that a repository's production dependencies use permissive licenses: 0BSD, Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, or ISC. | -| `license-check-allowed-additional` | false | string | | Provide a semicolon separated list of SPDX-license identifiers that you want to additionally allow. | -| `lint` | false | boolean | `false` | Set to `true` to run the `lint` script in a repository's `package.json`. | +| `auto-merge-exclude` | false | string | `fastify` | Provide a semicolon separated list of packages that you do not want to be auto-merged. | +| `license-check` | false | boolean | `false` | Set to `true` to check that a repository's production dependencies use permissive licenses: 0BSD, Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, or ISC. | +| `license-check-allowed-additional` | false | string | | Provide a semicolon separated list of SPDX-license identifiers that you want to additionally allow. | +| `lint` | false | boolean | `false` | Set to `true` to run the `lint` script in a repository's `package.json`. | +| `node-versions` | false | string | `'["18", "20", "21"]'` | Provide A JSON array that specifies the Node.js versions on which the job should run. | ## Benchmark PR workflow @@ -92,8 +93,7 @@ jobs: remove-label: if: "always()" - needs: - - benchmark + needs: benchmark runs-on: ubuntu-latest steps: - name: Remove benchmark label @@ -112,6 +112,7 @@ jobs: | Input Name | Required | Type | Default | Description | | ---------------------------------- | ---------- | ------- | ----------- | ---------------------------------------------------------------------------------- | | `npm-script` | false | string | `benchmark` | Provide the name of the npm script to run | +| `node-versions` | false | string | `'["18", "20", "21"]'` | Provide A JSON array that specifies the Node.js versions on which the job should run. | ## Acknowledgements