Skip to content

Commit

Permalink
Make node versions dynamic (#124)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
gurgunday authored Apr 23, 2024
1 parent 821ceac commit 05d3c0b
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 26 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/plugins-benchmark-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand All @@ -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
Expand Down Expand Up @@ -90,8 +96,7 @@ jobs:
echo 'EOF' >> $GITHUB_OUTPUT
output-benchmark:
needs:
- benchmark
needs: benchmark
runs-on: ubuntu-latest
permissions:
pull-requests: write
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/plugins-ci-kafka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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'
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/plugins-ci-mongo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/plugins-ci-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/plugins-ci-package-manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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]

Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/plugins-ci-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/plugins-ci-redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/plugins-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -92,8 +93,7 @@ jobs:
remove-label:
if: "always()"
needs:
- benchmark
needs: benchmark
runs-on: ubuntu-latest
steps:
- name: Remove benchmark label
Expand All @@ -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
Expand Down

0 comments on commit 05d3c0b

Please sign in to comment.