Skip to content

Commit

Permalink
fix: update CI to maintained node.js releases (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
ForbesLindesay authored Sep 25, 2024
1 parent 8035c02 commit 11c6946
Show file tree
Hide file tree
Showing 8 changed files with 246 additions and 479 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
refs:
- &container
docker:
- image: node:14
- image: node:20
environment:
PG_URL: 'postgres://test-user@localhost:5432/test-db'
MYSQL_URL: 'mysql://test-user:password@localhost:3306/test-db'
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows-src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import {
interpolate,
} from 'github-actions-workflow-builder/expression';

const DEFAULT_NODE_VERSION = '20.x';
const ALL_NODE_VERSIONS = ['18.x', '20.x', '22.x'];
const INTEGRATION_TEST_NODE_VERSIONS = ['18.x', '22.x'];

export function yarnInstallWithCache(nodeVersion: Expression<string>): Steps {
return ({use, run}) => {
const {
Expand All @@ -15,7 +19,7 @@ export function yarnInstallWithCache(nodeVersion: Expression<string>): Steps {
`Get yarn cache directory path`,
`echo "::set-output name=dir::$(yarn cache dir)"`,
);
use('Enable Cache', 'actions/cache@v2', {
use('Enable Cache', 'actions/cache@v4', {
with: {
path: [
interpolate`${yarnCacheDir}`,
Expand All @@ -30,7 +34,9 @@ export function yarnInstallWithCache(nodeVersion: Expression<string>): Steps {
run('yarn install --prefer-offline');
};
}
export function setup(nodeVersion: Expression<string> = '14.x'): Steps {
export function setup(
nodeVersion: Expression<string> = DEFAULT_NODE_VERSION,
): Steps {
return ({use, add}) => {
use('actions/checkout@v2');
use('actions/setup-node@v1', {
Expand All @@ -57,7 +63,7 @@ export function buildCache(): Steps {
}
})
.sort();
use(`Enable Cache`, 'actions/cache@v2', {
use(`Enable Cache`, 'actions/cache@v4', {
with: {
path: [
...packageNames.map((packageName) => `packages/${packageName}/lib`),
Expand Down Expand Up @@ -121,7 +127,7 @@ export default createWorkflow(({setWorkflowName, addTrigger, addJob}) => {

const {node} = setBuildMatrix(
{
node: ['14.x', '16.x', '18.x'],
node: ALL_NODE_VERSIONS,
},
{failFast: false},
);
Expand All @@ -140,7 +146,7 @@ export default createWorkflow(({setWorkflowName, addTrigger, addJob}) => {

const {node, pg} = setBuildMatrix(
{
node: ['14.x', '18.x'],
node: INTEGRATION_TEST_NODE_VERSIONS,
pg: [
// '9.6.19-alpine', -- unsupported by pg-migrations
'10.14-alpine',
Expand Down Expand Up @@ -168,7 +174,7 @@ export default createWorkflow(({setWorkflowName, addTrigger, addJob}) => {

const {node, mysql} = setBuildMatrix(
{
node: ['14.x', '18.x'],
node: INTEGRATION_TEST_NODE_VERSIONS,
mysql: ['5.6.51', '5.7.33', '8.0.23'],
},
{failFast: false},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows-src/website.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default createWorkflow(({setWorkflowName, addTrigger, addJob}) => {

run('yarn build');

use('Enable NextJS Cache', 'actions/cache@v2', {
use('Enable NextJS Cache', 'actions/cache@v4', {
with: {
path: ['packages/website/.next/cache'].join('\n'),
key: interpolate`next-${hashFiles('yarn.lock')}`,
Expand Down
80 changes: 40 additions & 40 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# !!! This file is auto-generated, do not edit by hand !!!
# To make changes, edit .github/workflows-src/test.ts and then run:
#
# github-actions-workflow-builder --directory ".github/workflows-src""
# github-actions-workflow-builder --directory ".github/workflows-src"

name: Test
on:
Expand All @@ -18,22 +18,22 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 20.x
registry-url: https://registry.npmjs.org
- name: Get yarn cache directory path
run: echo "::set-output name=dir::$(yarn cache dir)"
id: step_3
- name: Enable Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |-
${{steps.step_3.outputs.dir}}
${{ steps.step_3.outputs.dir }}
node_modules
packages/*/node_modules
key: ${{runner.os}}-14.x-${{hashFiles('yarn.lock')}}-2
key: ${{ runner.os }}-20.x-${{ hashFiles('yarn.lock') }}-2
- run: yarn install --prefer-offline
- name: Enable Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |-
packages/bigquery/lib
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
packages/websql/.last_build
packages/websql-core/.last_build
packages/with-container/.last_build
key: v2-build-output-${{hashFiles('yarn.lock', 'packages/bigquery/src',
key: v2-build-output-${{ hashFiles('yarn.lock', 'packages/bigquery/src',
'packages/cache/src', 'packages/connection-pool/src',
'packages/dataloader/src', 'packages/escape-identifier/src',
'packages/expo/src', 'packages/lock/src',
Expand All @@ -144,7 +144,7 @@ jobs:
'packages/sql/src', 'packages/sqlite/src',
'packages/sqlite-sync/src', 'packages/validate-unicode/src',
'packages/websql/src', 'packages/websql-core/src',
'packages/with-container/src')}}
'packages/with-container/src') }}
restore-keys: v2-build-output-
- run: yarn build
- name: "Save output: build"
Expand All @@ -155,17 +155,17 @@ jobs:
packages/*/lib
packages/*/.last_build
outputs:
output: build
output: ${{ toJSON('build') }}
test_node:
needs:
- build
runs-on: ubuntu-latest
strategy:
matrix:
node:
- 14.x
- 16.x
- 18.x
- 20.x
- 22.x
fail-fast: false
steps:
- uses: actions/checkout@v2
Expand All @@ -177,18 +177,18 @@ jobs:
run: echo "::set-output name=dir::$(yarn cache dir)"
id: step_3
- name: Enable Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |-
${{steps.step_3.outputs.dir}}
${{ steps.step_3.outputs.dir }}
node_modules
packages/*/node_modules
key: ${{runner.os}}-${{matrix.node}}-${{hashFiles('yarn.lock')}}-2
key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}-2
- run: yarn install --prefer-offline
- name: "Load output: ${{needs.build.outputs.output}}"
- name: "Load output: ${{ fromJSON(needs.build.outputs.output) }}"
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.output }}
name: ${{ fromJSON(needs.build.outputs.output) }}
path: packages/
- run: yarn test:node
test_pg:
Expand All @@ -198,8 +198,8 @@ jobs:
strategy:
matrix:
node:
- 14.x
- 18.x
- 22.x
pg:
- 10.14-alpine
- 11.9-alpine
Expand All @@ -216,22 +216,22 @@ jobs:
run: echo "::set-output name=dir::$(yarn cache dir)"
id: step_3
- name: Enable Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |-
${{steps.step_3.outputs.dir}}
${{ steps.step_3.outputs.dir }}
node_modules
packages/*/node_modules
key: ${{runner.os}}-${{matrix.node}}-${{hashFiles('yarn.lock')}}-2
key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}-2
- run: yarn install --prefer-offline
- name: "Load output: ${{needs.build.outputs.output}}"
- name: "Load output: ${{ fromJSON(needs.build.outputs.output) }}"
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.output }}
name: ${{ fromJSON(needs.build.outputs.output) }}
path: packages/
- run: yarn test:pg
env:
PG_TEST_IMAGE: postgres:${{matrix.pg}}
PG_TEST_IMAGE: postgres:${{ matrix.pg }}
PG_TEST_DEBUG: "TRUE"
test_mysql:
needs:
Expand All @@ -240,8 +240,8 @@ jobs:
strategy:
matrix:
node:
- 14.x
- 18.x
- 22.x
mysql:
- 5.6.51
- 5.7.33
Expand All @@ -257,41 +257,41 @@ jobs:
run: echo "::set-output name=dir::$(yarn cache dir)"
id: step_3
- name: Enable Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |-
${{steps.step_3.outputs.dir}}
${{ steps.step_3.outputs.dir }}
node_modules
packages/*/node_modules
key: ${{runner.os}}-${{matrix.node}}-${{hashFiles('yarn.lock')}}-2
key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}-2
- run: yarn install --prefer-offline
- name: "Load output: ${{needs.build.outputs.output}}"
- name: "Load output: ${{ fromJSON(needs.build.outputs.output) }}"
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.output }}
name: ${{ fromJSON(needs.build.outputs.output) }}
path: packages/
- run: yarn test:mysql
env:
MYSQL_TEST_IMAGE: mysql:${{matrix.mysql}}
MYSQL_TEST_IMAGE: mysql:${{ matrix.mysql }}
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 20.x
registry-url: https://registry.npmjs.org
- name: Get yarn cache directory path
run: echo "::set-output name=dir::$(yarn cache dir)"
id: step_3
- name: Enable Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |-
${{steps.step_3.outputs.dir}}
${{ steps.step_3.outputs.dir }}
node_modules
packages/*/node_modules
key: ${{runner.os}}-14.x-${{hashFiles('yarn.lock')}}-2
key: ${{ runner.os }}-20.x-${{ hashFiles('yarn.lock') }}-2
- run: yarn install --prefer-offline
- run: yarn prettier:check
lint:
Expand All @@ -302,23 +302,23 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 20.x
registry-url: https://registry.npmjs.org
- name: Get yarn cache directory path
run: echo "::set-output name=dir::$(yarn cache dir)"
id: step_3
- name: Enable Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |-
${{steps.step_3.outputs.dir}}
${{ steps.step_3.outputs.dir }}
node_modules
packages/*/node_modules
key: ${{runner.os}}-14.x-${{hashFiles('yarn.lock')}}-2
key: ${{ runner.os }}-20.x-${{ hashFiles('yarn.lock') }}-2
- run: yarn install --prefer-offline
- name: "Load output: ${{needs.build.outputs.output}}"
- name: "Load output: ${{ fromJSON(needs.build.outputs.output) }}"
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.output }}
name: ${{ fromJSON(needs.build.outputs.output) }}
path: packages/
- run: yarn tslint
20 changes: 10 additions & 10 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# !!! This file is auto-generated, do not edit by hand !!!
# To make changes, edit .github/workflows-src/website.ts and then run:
#
# github-actions-workflow-builder --directory ".github/workflows-src""
# github-actions-workflow-builder --directory ".github/workflows-src"

name: Website
on:
Expand All @@ -18,22 +18,22 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 20.x
registry-url: https://registry.npmjs.org
- name: Get yarn cache directory path
run: echo "::set-output name=dir::$(yarn cache dir)"
id: step_3
- name: Enable Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |-
${{steps.step_3.outputs.dir}}
${{ steps.step_3.outputs.dir }}
node_modules
packages/*/node_modules
key: ${{runner.os}}-14.x-${{hashFiles('yarn.lock')}}-2
key: ${{ runner.os }}-20.x-${{ hashFiles('yarn.lock') }}-2
- run: yarn install --prefer-offline
- name: Enable Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |-
packages/bigquery/lib
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
packages/websql/.last_build
packages/websql-core/.last_build
packages/with-container/.last_build
key: v2-build-output-${{hashFiles('yarn.lock', 'packages/bigquery/src',
key: v2-build-output-${{ hashFiles('yarn.lock', 'packages/bigquery/src',
'packages/cache/src', 'packages/connection-pool/src',
'packages/dataloader/src', 'packages/escape-identifier/src',
'packages/expo/src', 'packages/lock/src',
Expand All @@ -144,14 +144,14 @@ jobs:
'packages/sql/src', 'packages/sqlite/src',
'packages/sqlite-sync/src', 'packages/validate-unicode/src',
'packages/websql/src', 'packages/websql-core/src',
'packages/with-container/src')}}
'packages/with-container/src') }}
restore-keys: v2-build-output-
- run: yarn build
- name: Enable NextJS Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: packages/website/.next/cache
key: next-${{hashFiles('yarn.lock')}}
key: next-${{ hashFiles('yarn.lock') }}
restore-keys: next-
- run: yarn workspace @databases/website build
- if: ${{ github.event_name == 'push' }}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@types/jest": "^26.0.15",
"@types/node": "^14.14.25",
"cross-spawn": "^7.0.2",
"github-actions-workflow-builder": "^1.0.3",
"github-actions-workflow-builder": "^4.0.1",
"jest": "^26.6.1",
"lsr": "^2.0.0",
"mkdirp": "^1.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/websql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"types": "./lib/index.d.ts",
"dependencies": {
"@databases/websql-core": "^0.0.0",
"websql": "^1.0.0"
"websql": "^2.0.3"
},
"scripts": {},
"repository": "https://github.com/ForbesLindesay/atdatabases/tree/master/packages/websql",
Expand Down
Loading

0 comments on commit 11c6946

Please sign in to comment.