Skip to content

Commit

Permalink
fix: Run yarn tests on node 18 (#5197)
Browse files Browse the repository at this point in the history
* fix: Run yarn tests on node 18

They no longer work with node 16

* Fix check-folders script to check `include` option of matrix

* Run vercel-with-redwood on node 18
  • Loading branch information
SevInf authored Jul 8, 2024
1 parent d8e0418 commit 13eb6d5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 28 deletions.
43 changes: 22 additions & 21 deletions .github/scripts/check-folders.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ async function main() {
'cleanup-runs', // Not a test but a job that cancels previous runs
]

// Keys to ignore
// TODO better description what this actually means
const keysToIgnore = [
'os', // We want to count folders vs references in the yaml file not when something is run across different OSes
'node', // We want to count folders vs references in the yaml file not when something is run across different node versions
'm1', // it's almost a copy of `os` but running on M1
]

// Get all relevant folders that _should_ appear in workflows
const folders = glob
.sync('**/package.json', {
Expand Down Expand Up @@ -74,25 +66,14 @@ async function main() {
// jobs
const job = testYaml['jobs'][key]
const matrix = Boolean(job) && Boolean(job.strategy) ? job.strategy.matrix : {}
const folders = Object.keys(matrix)
.filter((key) => {
return !keysToIgnore.includes(key)
})
.reduce((acc, key) => acc.concat(...matrix[key]), [])
const folders = foldersFromMatrix(matrix)

// optional jobs
const job_optional = optionalTestYaml['jobs'][key]
const matrix_optional =
Boolean(job_optional) && Boolean(job_optional.strategy) ? job_optional.strategy.matrix : {}

const folders_optional = Object.keys(matrix_optional)
.filter((key) => {
// These are in optional-test.yaml, under the `platforms` directory
return !keysToIgnore.includes(key)
})
.reduce((acc, key) => {
return acc.concat(...matrix_optional[key])
}, [])
const folders_optional = foldersFromMatrix(matrix_optional)

return folders.concat(folders_optional).map((folder) => `${key}/${folder}`)
})
Expand Down Expand Up @@ -124,4 +105,24 @@ async function main() {
}
}

// Keys to ignore
const keysToIgnore = [
'os', // We want to count folders vs references in the yaml file not when something is run across different OSes
'node', // We want to count folders vs references in the yaml file not when something is run across different node versions
'm1', // it's almost a copy of `os` but running on M1
]

function foldersFromMatrix(matrix) {
return Object.keys(matrix)
.filter((key) => {
return !keysToIgnore.includes(key)
})
.flatMap(key => {
if (key == 'include' && Array.isArray(matrix[key])) {
return matrix[key].flatMap(foldersFromMatrix)
}
return matrix[key]
})
}

main()
23 changes: 16 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -485,16 +485,22 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [16]
packager:
- npm
- npm-global
- pnpm
- pnpm-workspaces-custom-output
- pnpm-workspaces-default-output
- yarn
- yarn-workspaces
- yarn3-without-pnp
- yarn3-workspaces-pnp
include:
- packager: yarn
node: 18
- packager: yarn-workspaces
node: 18
- packager: yarn3-without-pnp
node: 18
- packager: yarn3-workspaces-pnp
node: 18
clientEngine: [library] #['library', 'binary']
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
Expand All @@ -518,7 +524,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 16
node-version: ${{ matrix.node }}
cache: |
${{
contains(matrix.packager, 'yarn') && 'yarn' ||
Expand Down Expand Up @@ -770,14 +776,17 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [16]
platform:
- vercel-node-builder
- vercel-cli
- vercel-with-redwood
- vercel-with-nextjs
- vercel-with-nextjs-caching
clientEngine: ['library', 'binary']
os: [ubuntu-20.04]
include:
- platform: vercel-with-redwood
node: 18
runs-on: ${{ matrix.os }}
concurrency: ${{ github.job }}-${{ matrix.platform }}-${{ matrix.clientEngine }}
env:
Expand Down Expand Up @@ -806,7 +815,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 16
node-version: ${{ matrix.node }}
cache: |
${{
contains(matrix.platform, 'redwood') && 'yarn' ||
Expand Down

0 comments on commit 13eb6d5

Please sign in to comment.