2024-10-13 03:30:54 +00:00
|
|
|
name: NocoBase backend test
|
2022-01-08 09:16:11 +00:00
|
|
|
|
2024-02-08 03:35:59 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-09-19 01:23:01 +00:00
|
|
|
on:
|
2022-09-27 14:50:10 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2024-06-30 11:41:39 +00:00
|
|
|
- next
|
2022-10-28 03:41:48 +00:00
|
|
|
paths:
|
2023-12-18 14:41:14 +00:00
|
|
|
- 'package.json'
|
2024-05-14 01:23:33 +00:00
|
|
|
- '**/yarn.lock'
|
2023-03-30 10:27:38 +00:00
|
|
|
- 'packages/core/acl/**'
|
|
|
|
- 'packages/core/actions/**'
|
|
|
|
- 'packages/core/database/**'
|
2024-03-27 04:03:00 +00:00
|
|
|
- 'packages/core/resourcer/**'
|
|
|
|
- 'packages/core/data-source-manager/**'
|
2023-03-30 10:27:38 +00:00
|
|
|
- 'packages/core/server/**'
|
2023-12-28 05:40:11 +00:00
|
|
|
- 'packages/core/utils/**'
|
2023-03-30 10:27:38 +00:00
|
|
|
- 'packages/plugins/**/src/server/**'
|
2023-06-09 01:23:04 +00:00
|
|
|
- '.github/workflows/nocobase-test-backend.yml'
|
2022-09-19 01:23:01 +00:00
|
|
|
pull_request:
|
2022-10-28 03:41:48 +00:00
|
|
|
paths:
|
2023-12-18 14:41:14 +00:00
|
|
|
- 'package.json'
|
2024-05-14 01:23:33 +00:00
|
|
|
- '**/yarn.lock'
|
2023-03-30 10:27:38 +00:00
|
|
|
- 'packages/core/acl/**'
|
|
|
|
- 'packages/core/actions/**'
|
|
|
|
- 'packages/core/database/**'
|
2024-03-27 04:03:00 +00:00
|
|
|
- 'packages/core/resourcer/**'
|
|
|
|
- 'packages/core/data-source-manager/**'
|
2023-03-30 10:27:38 +00:00
|
|
|
- 'packages/core/server/**'
|
2023-12-28 05:40:11 +00:00
|
|
|
- 'packages/core/utils/**'
|
2023-03-30 10:27:38 +00:00
|
|
|
- 'packages/plugins/**/src/server/**'
|
2023-06-09 01:23:04 +00:00
|
|
|
- '.github/workflows/nocobase-test-backend.yml'
|
2022-01-08 09:16:11 +00:00
|
|
|
|
|
|
|
jobs:
|
2023-02-22 04:05:59 +00:00
|
|
|
sqlite-test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-06-14 02:19:56 +00:00
|
|
|
node_version: ['20']
|
2023-07-14 06:49:12 +00:00
|
|
|
underscored: [true, false]
|
2023-02-22 04:05:59 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: node:${{ matrix.node_version }}
|
2024-07-10 13:48:58 +00:00
|
|
|
services:
|
|
|
|
redis:
|
|
|
|
image: redis:latest
|
|
|
|
ports:
|
|
|
|
- 6379:6379
|
2023-02-22 04:05:59 +00:00
|
|
|
steps:
|
2023-10-17 23:40:39 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-02-22 04:05:59 +00:00
|
|
|
- name: Use Node.js ${{ matrix.node_version }}
|
2024-06-14 02:19:56 +00:00
|
|
|
uses: actions/setup-node@v4
|
2023-02-22 04:05:59 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node_version }}
|
2024-06-14 02:19:56 +00:00
|
|
|
cache: 'yarn'
|
2023-10-17 23:40:39 +00:00
|
|
|
- name: Install project dependencies
|
2024-06-14 02:19:56 +00:00
|
|
|
run: yarn install
|
2022-10-28 03:41:48 +00:00
|
|
|
- name: Test with Sqlite
|
2023-12-21 12:39:11 +00:00
|
|
|
run: yarn test --server --single-thread=false
|
2022-10-28 03:41:48 +00:00
|
|
|
env:
|
2023-07-27 13:57:13 +00:00
|
|
|
LOGGER_LEVEL: error
|
2022-10-28 03:41:48 +00:00
|
|
|
DB_DIALECT: sqlite
|
|
|
|
DB_STORAGE: /tmp/db.sqlite
|
2023-10-17 14:22:45 +00:00
|
|
|
DB_TEST_PREFIX: test_
|
2023-02-16 02:53:04 +00:00
|
|
|
DB_UNDERSCORED: ${{ matrix.underscored }}
|
2024-08-09 09:14:37 +00:00
|
|
|
ENCRYPTION_FIELD_KEY: 1%&glK;<UA}aIxJVc53-4G(rTi0vg@J]
|
2022-10-28 03:41:48 +00:00
|
|
|
|
|
|
|
postgres-test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-06-14 02:19:56 +00:00
|
|
|
node_version: ['20']
|
2023-07-14 06:49:12 +00:00
|
|
|
underscored: [true, false]
|
|
|
|
schema: [public, nocobase]
|
|
|
|
collection_schema: [public, user_schema]
|
2022-01-08 09:16:11 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: node:${{ matrix.node_version }}
|
|
|
|
services:
|
|
|
|
# Label used to access the service container
|
|
|
|
postgres:
|
|
|
|
# Docker Hub image
|
2023-07-14 06:49:12 +00:00
|
|
|
image: postgres:11
|
2022-01-08 09:16:11 +00:00
|
|
|
# Provide the password for postgres
|
|
|
|
env:
|
|
|
|
POSTGRES_USER: nocobase
|
|
|
|
POSTGRES_PASSWORD: password
|
|
|
|
# Set health checks to wait until postgres has started
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
2024-07-10 13:48:58 +00:00
|
|
|
redis:
|
|
|
|
image: redis:latest
|
|
|
|
ports:
|
|
|
|
- 6379:6379
|
2022-01-08 09:16:11 +00:00
|
|
|
steps:
|
2023-10-17 23:40:39 +00:00
|
|
|
- uses: actions/checkout@v4
|
2022-01-08 09:16:11 +00:00
|
|
|
- name: Use Node.js ${{ matrix.node_version }}
|
2024-06-14 02:19:56 +00:00
|
|
|
uses: actions/setup-node@v4
|
2022-01-08 09:16:11 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node_version }}
|
2024-06-14 02:19:56 +00:00
|
|
|
cache: 'yarn'
|
2023-10-17 23:40:39 +00:00
|
|
|
|
|
|
|
- name: Install project dependencies
|
2024-06-14 02:19:56 +00:00
|
|
|
run: yarn install
|
2022-01-08 09:16:11 +00:00
|
|
|
- name: Test with postgres
|
2023-10-17 14:22:45 +00:00
|
|
|
run: |
|
|
|
|
./node_modules/.bin/tsx packages/core/test/src/scripts/test-db-creator.ts &
|
|
|
|
sleep 1
|
2023-12-21 12:39:11 +00:00
|
|
|
yarn test --server --single-thread=false
|
2022-01-08 09:16:11 +00:00
|
|
|
env:
|
2023-07-27 13:57:13 +00:00
|
|
|
LOGGER_LEVEL: error
|
2022-01-08 09:16:11 +00:00
|
|
|
DB_DIALECT: postgres
|
|
|
|
DB_HOST: postgres
|
|
|
|
DB_PORT: 5432
|
|
|
|
DB_USER: nocobase
|
|
|
|
DB_PASSWORD: password
|
|
|
|
DB_DATABASE: nocobase
|
2023-02-16 02:53:04 +00:00
|
|
|
DB_UNDERSCORED: ${{ matrix.underscored }}
|
|
|
|
DB_SCHEMA: ${{ matrix.schema }}
|
2023-03-05 06:45:56 +00:00
|
|
|
COLLECTION_MANAGER_SCHEMA: ${{ matrix.collection_schema }}
|
2023-10-17 14:22:45 +00:00
|
|
|
DB_TEST_DISTRIBUTOR_PORT: 23450
|
2024-07-04 13:48:51 +00:00
|
|
|
DB_TEST_PREFIX: test
|
2024-08-09 09:14:37 +00:00
|
|
|
ENCRYPTION_FIELD_KEY: 1%&glK;<UA}aIxJVc53-4G(rTi0vg@J]
|
2024-04-30 13:21:17 +00:00
|
|
|
timeout-minutes: 60
|
2022-10-28 03:41:48 +00:00
|
|
|
|
|
|
|
mysql-test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-06-14 02:19:56 +00:00
|
|
|
node_version: ['20']
|
2023-07-14 06:49:12 +00:00
|
|
|
underscored: [true, false]
|
2022-10-28 03:41:48 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: node:${{ matrix.node_version }}
|
|
|
|
services:
|
|
|
|
mysql:
|
2024-01-20 12:59:49 +00:00
|
|
|
image: mysql:8.2 # >= 8.3 will meet unsolved error: https://github.com/nocobase/nocobase/actions/runs/7581141593/job/20653828990?pr=3383
|
2022-01-08 09:16:11 +00:00
|
|
|
env:
|
2022-10-28 03:41:48 +00:00
|
|
|
MYSQL_ROOT_PASSWORD: password
|
|
|
|
MYSQL_DATABASE: nocobase
|
|
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
2024-07-10 13:48:58 +00:00
|
|
|
redis:
|
|
|
|
image: redis:latest
|
|
|
|
ports:
|
|
|
|
- 6379:6379
|
2022-10-28 03:41:48 +00:00
|
|
|
steps:
|
2023-10-17 23:40:39 +00:00
|
|
|
- uses: actions/checkout@v4
|
2022-10-28 03:41:48 +00:00
|
|
|
- name: Use Node.js ${{ matrix.node_version }}
|
2024-06-14 02:19:56 +00:00
|
|
|
uses: actions/setup-node@v4
|
2022-10-28 03:41:48 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node_version }}
|
2024-06-14 02:19:56 +00:00
|
|
|
cache: 'yarn'
|
2023-10-17 23:40:39 +00:00
|
|
|
|
|
|
|
- name: Install project dependencies
|
2024-06-14 02:19:56 +00:00
|
|
|
run: yarn install
|
2022-01-08 09:16:11 +00:00
|
|
|
- name: Test with MySQL
|
2023-10-17 14:22:45 +00:00
|
|
|
run: |
|
|
|
|
./node_modules/.bin/tsx packages/core/test/src/scripts/test-db-creator.ts &
|
|
|
|
sleep 1
|
2023-12-21 12:39:11 +00:00
|
|
|
yarn test --server --single-thread=false
|
2022-01-08 09:16:11 +00:00
|
|
|
env:
|
2023-07-27 13:57:13 +00:00
|
|
|
LOGGER_LEVEL: error
|
2022-01-08 09:16:11 +00:00
|
|
|
DB_DIALECT: mysql
|
|
|
|
DB_HOST: mysql
|
|
|
|
DB_PORT: 3306
|
|
|
|
DB_USER: root
|
|
|
|
DB_PASSWORD: password
|
|
|
|
DB_DATABASE: nocobase
|
2023-02-16 02:53:04 +00:00
|
|
|
DB_UNDERSCORED: ${{ matrix.underscored }}
|
2023-10-17 14:22:45 +00:00
|
|
|
DB_TEST_DISTRIBUTOR_PORT: 23450
|
|
|
|
DB_TEST_PREFIX: test_
|
2024-08-09 09:14:37 +00:00
|
|
|
ENCRYPTION_FIELD_KEY: 1%&glK;<UA}aIxJVc53-4G(rTi0vg@J]
|
2024-04-30 13:21:17 +00:00
|
|
|
timeout-minutes: 60
|
2023-11-20 00:54:40 +00:00
|
|
|
mariadb-test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-06-14 02:19:56 +00:00
|
|
|
node_version: ['20']
|
2023-11-20 00:54:40 +00:00
|
|
|
underscored: [true, false]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: node:${{ matrix.node_version }}
|
|
|
|
services:
|
|
|
|
mariadb:
|
|
|
|
image: mariadb:10.9
|
|
|
|
env:
|
|
|
|
MARIADB_ROOT_PASSWORD: password
|
|
|
|
MARIADB_DATABASE: nocobase
|
|
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
2024-07-10 13:48:58 +00:00
|
|
|
redis:
|
|
|
|
image: redis:latest
|
|
|
|
ports:
|
|
|
|
- 6379:6379
|
2023-11-20 00:54:40 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Use Node.js ${{ matrix.node_version }}
|
2024-06-14 02:19:56 +00:00
|
|
|
uses: actions/setup-node@v4
|
2023-11-20 00:54:40 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node_version }}
|
2024-06-14 02:19:56 +00:00
|
|
|
cache: 'yarn'
|
2023-11-20 00:54:40 +00:00
|
|
|
|
2024-06-14 02:19:56 +00:00
|
|
|
- name: Install project dependencies
|
|
|
|
run: yarn install
|
2023-11-20 00:54:40 +00:00
|
|
|
- name: Install project dependencies
|
|
|
|
run: yarn --prefer-offline
|
|
|
|
- name: Test with MariaDB
|
|
|
|
run: |
|
|
|
|
./node_modules/.bin/tsx packages/core/test/src/scripts/test-db-creator.ts &
|
|
|
|
sleep 1
|
2023-12-21 12:39:11 +00:00
|
|
|
yarn test --server --single-thread=false
|
2023-11-20 00:54:40 +00:00
|
|
|
env:
|
|
|
|
LOGGER_LEVEL: error
|
|
|
|
DB_DIALECT: mariadb
|
|
|
|
DB_HOST: mariadb
|
|
|
|
DB_PORT: 3306
|
|
|
|
DB_USER: root
|
|
|
|
DB_PASSWORD: password
|
|
|
|
DB_DATABASE: nocobase
|
|
|
|
DB_UNDERSCORED: ${{ matrix.underscored }}
|
|
|
|
DB_TEST_DISTRIBUTOR_PORT: 23450
|
|
|
|
DB_TEST_PREFIX: test_
|
2024-08-09 09:14:37 +00:00
|
|
|
ENCRYPTION_FIELD_KEY: 1%&glK;<UA}aIxJVc53-4G(rTi0vg@J]
|
2024-04-30 13:21:17 +00:00
|
|
|
timeout-minutes: 60
|