Skip to content

chore: try testing in the ci against node 22 & 24 as well as pg, mysq… #114

chore: try testing in the ci against node 22 & 24 as well as pg, mysq…

chore: try testing in the ci against node 22 & 24 as well as pg, mysq… #114

Workflow file for this run

name: Tests
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
setup:
name: 'setup (node ${{ matrix.node-version }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [22, 24]
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.18.1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Cache setup
id: setup-cache
uses: actions/cache@v4
with:
path: |
node_modules
apps/*/node_modules
packages/*/node_modules
~/.cache/ms-playwright
packages/*/dist
apps/*/dist
key: ${{ runner.os }}-node${{ matrix.node-version }}-setup-${{ hashFiles('pnpm-lock.yaml', 'packages/**', 'apps/**') }}
- name: Install dependencies
if: steps.setup-cache.outputs.cache-hit != 'true'
run: pnpm install --config.inject-workspace-packages=true --no-frozen-lockfile
- name: Run build
if: steps.setup-cache.outputs.cache-hit != 'true'
run: pnpm run build
lint:
needs: [setup]
name: 'lint (node ${{ matrix.node-version }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [22, 24]
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.18.1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Restore setup
uses: actions/cache@v4
with:
path: |
node_modules
apps/*/node_modules
packages/*/node_modules
~/.cache/ms-playwright
packages/*/dist
apps/*/dist
key: ${{ runner.os }}-node${{ matrix.node-version }}-setup-${{ hashFiles('pnpm-lock.yaml', 'packages/**', 'apps/**') }}
- name: Run linting
run: pnpm run lint
typescript:
needs: [setup]
name: 'typescript (node ${{ matrix.node-version }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [22, 24]
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.18.1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Restore setup
uses: actions/cache@v4
with:
path: |
node_modules
apps/*/node_modules
packages/*/node_modules
~/.cache/ms-playwright
packages/*/dist
apps/*/dist
key: ${{ runner.os }}-node${{ matrix.node-version }}-setup-${{ hashFiles('pnpm-lock.yaml', 'packages/**', 'apps/**') }}
- name: Run TypeScript checks
run: pnpm run check-types
test-integration-sqlite:
needs: [setup, lint, typescript]
name: 'test:integration (sqlite, node ${{ matrix.node-version }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [22, 24]
env:
DATABASE_CLIENT: sqlite
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.18.1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Restore setup
uses: actions/cache@v4
with:
path: |
node_modules
apps/*/node_modules
packages/*/node_modules
~/.cache/ms-playwright
packages/*/dist
apps/*/dist
key: ${{ runner.os }}-node${{ matrix.node-version }}-setup-${{ hashFiles('pnpm-lock.yaml', 'packages/**', 'apps/**') }}
- name: Run integration tests
run: pnpm run test:integration
test-integration-postgres:
needs: [setup, lint, typescript]
name: 'test:integration (postgres, node ${{ matrix.node-version }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [22, 24]
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: strapi
POSTGRES_PASSWORD: strapi
POSTGRES_DB: strapi_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_CLIENT: postgres
DATABASE_HOST: localhost
DATABASE_PORT: 5432
DATABASE_NAME: strapi_test
DATABASE_USERNAME: strapi
DATABASE_PASSWORD: strapi
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.18.1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Restore setup
uses: actions/cache@v4
with:
path: |
node_modules
apps/*/node_modules
packages/*/node_modules
~/.cache/ms-playwright
packages/*/dist
apps/*/dist
key: ${{ runner.os }}-node${{ matrix.node-version }}-setup-${{ hashFiles('pnpm-lock.yaml', 'packages/**', 'apps/**') }}
- name: Run integration tests
run: pnpm run test:integration
test-integration-mysql:
needs: [setup, lint, typescript]
name: 'test:integration (mysql, node ${{ matrix.node-version }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [22, 24]
services:
mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: strapi_test
MYSQL_USER: strapi
MYSQL_PASSWORD: strapi
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_CLIENT: mysql
DATABASE_HOST: 127.0.0.1
DATABASE_PORT: 3306
DATABASE_NAME: strapi_test
DATABASE_USERNAME: strapi
DATABASE_PASSWORD: strapi
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.18.1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Restore setup
uses: actions/cache@v4
with:
path: |
node_modules
apps/*/node_modules
packages/*/node_modules
~/.cache/ms-playwright
packages/*/dist
apps/*/dist
key: ${{ runner.os }}-node${{ matrix.node-version }}-setup-${{ hashFiles('pnpm-lock.yaml', 'packages/**', 'apps/**') }}
- name: Run integration tests
run: pnpm run test:integration
test-e2e-sqlite:
needs: [setup, lint, typescript]
name: 'test:e2e (sqlite, node ${{ matrix.node-version }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [22, 24]
env:
DATABASE_CLIENT: sqlite
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.18.1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Restore setup
uses: actions/cache@v4
with:
path: |
node_modules
apps/*/node_modules
packages/*/node_modules
~/.cache/ms-playwright
packages/*/dist
apps/*/dist
key: ${{ runner.os }}-node${{ matrix.node-version }}-setup-${{ hashFiles('pnpm-lock.yaml', 'packages/**', 'apps/**') }}
- name: Run e2e tests
run: pnpm run test:e2e
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report-node${{ matrix.node-version }}-sqlite
path: '**/playwright-report/'
retention-days: 30
test-e2e-postgres:
needs: [setup, lint, typescript]
name: 'test:e2e (postgres, node ${{ matrix.node-version }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [22, 24]
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: strapi
POSTGRES_PASSWORD: strapi
POSTGRES_DB: strapi_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_CLIENT: postgres
DATABASE_HOST: localhost
DATABASE_PORT: 5432
DATABASE_NAME: strapi_test
DATABASE_USERNAME: strapi
DATABASE_PASSWORD: strapi
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.18.1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Restore setup
uses: actions/cache@v4
with:
path: |
node_modules
apps/*/node_modules
packages/*/node_modules
~/.cache/ms-playwright
packages/*/dist
apps/*/dist
key: ${{ runner.os }}-node${{ matrix.node-version }}-setup-${{ hashFiles('pnpm-lock.yaml', 'packages/**', 'apps/**') }}
- name: Run e2e tests
run: pnpm run test:e2e
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report-node${{ matrix.node-version }}-postgres
path: '**/playwright-report/'
retention-days: 30
test-e2e-mysql:
needs: [setup, lint, typescript]
name: 'test:e2e (mysql, node ${{ matrix.node-version }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [22, 24]
services:
mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: strapi_test
MYSQL_USER: strapi
MYSQL_PASSWORD: strapi
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_CLIENT: mysql
DATABASE_HOST: 127.0.0.1
DATABASE_PORT: 3306
DATABASE_NAME: strapi_test
DATABASE_USERNAME: strapi
DATABASE_PASSWORD: strapi
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.18.1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Restore setup
uses: actions/cache@v4
with:
path: |
node_modules
apps/*/node_modules
packages/*/node_modules
~/.cache/ms-playwright
packages/*/dist
apps/*/dist
key: ${{ runner.os }}-node${{ matrix.node-version }}-setup-${{ hashFiles('pnpm-lock.yaml', 'packages/**', 'apps/**') }}
- name: Run e2e tests
run: pnpm run test:e2e
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report-node${{ matrix.node-version }}-mysql
path: '**/playwright-report/'
retention-days: 30