2023-06-09 01:23:04 +00:00
|
|
|
name: NocoBase Backend Test
|
2022-01-08 09:16:11 +00:00
|
|
|
|
2024-02-08 03:25:57 +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
|
2022-10-28 03:41:48 +00:00
|
|
|
paths:
|
2023-12-18 14:41:14 +00:00
|
|
|
- 'package.json'
|
2023-03-30 10:27:38 +00:00
|
|
|
- 'packages/core/acl/**'
|
|
|
|
- 'packages/core/actions/**'
|
|
|
|
- 'packages/core/database/**'
|
|
|
|
- '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'
|
2023-03-30 10:27:38 +00:00
|
|
|
- 'packages/core/acl/**'
|
|
|
|
- 'packages/core/actions/**'
|
|
|
|
- 'packages/core/database/**'
|
|
|
|
- '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:
|
2023-07-14 06:49:12 +00:00
|
|
|
node_version: ['18']
|
|
|
|
underscored: [true, false]
|
2023-02-22 04:05:59 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: node:${{ matrix.node_version }}
|
|
|
|
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 }}
|
2023-10-17 23:40:39 +00:00
|
|
|
uses: actions/setup-node@v3
|
2023-02-22 04:05:59 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node_version }}
|
2023-10-17 23:40:39 +00:00
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-
|
|
|
|
|
|
|
|
- name: Install project dependencies
|
|
|
|
run: yarn --prefer-offline
|
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 }}
|
2023-08-24 09:47:45 +00:00
|
|
|
timeout-minutes: 40
|
2022-10-28 03:41:48 +00:00
|
|
|
|
|
|
|
postgres-test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-07-14 06:49:12 +00:00
|
|
|
node_version: ['18']
|
|
|
|
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
|
|
|
|
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 }}
|
2023-10-17 23:40:39 +00:00
|
|
|
uses: actions/setup-node@v3
|
2022-01-08 09:16:11 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node_version }}
|
2023-10-17 23:40:39 +00:00
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-
|
|
|
|
|
|
|
|
- name: Install project dependencies
|
|
|
|
run: yarn --prefer-offline
|
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
|
|
|
|
DB_TEST_PREFIX: test_
|
2023-08-24 09:47:45 +00:00
|
|
|
timeout-minutes: 40
|
2022-10-28 03:41:48 +00:00
|
|
|
|
|
|
|
mysql-test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-07-14 06:49:12 +00:00
|
|
|
node_version: ['18']
|
|
|
|
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
|
|
|
|
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 }}
|
2023-10-17 23:40:39 +00:00
|
|
|
uses: actions/setup-node@v3
|
2022-10-28 03:41:48 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node_version }}
|
2023-10-17 23:40:39 +00:00
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-
|
|
|
|
- name: Install project dependencies
|
|
|
|
run: yarn --prefer-offline
|
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_
|
2023-08-24 09:47:45 +00:00
|
|
|
timeout-minutes: 40
|
2023-11-20 00:54:40 +00:00
|
|
|
mariadb-test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
node_version: ['18']
|
|
|
|
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
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Use Node.js ${{ matrix.node_version }}
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node_version }}
|
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-
|
|
|
|
- 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_
|
|
|
|
timeout-minutes: 40
|