From f1cc991c1c12fa58ffa8137c33f7100724fcad9d Mon Sep 17 00:00:00 2001 From: ChengLei Shao Date: Fri, 9 Jun 2023 09:23:04 +0800 Subject: [PATCH] chore(github-actions): separate frontend and backend tests (#2013) --- .github/workflows/nocobase-build-test.yml | 34 ++++++++ ...est-full.yml => nocobase-test-backend.yml} | 43 ++++------ .github/workflows/nocobase-test-frontend.yml | 42 ++++++++++ .github/workflows/nocobase-test-lite.yml | 83 ------------------- 4 files changed, 90 insertions(+), 112 deletions(-) create mode 100644 .github/workflows/nocobase-build-test.yml rename .github/workflows/{nocobase-test-full.yml => nocobase-test-backend.yml} (77%) create mode 100644 .github/workflows/nocobase-test-frontend.yml delete mode 100644 .github/workflows/nocobase-test-lite.yml diff --git a/.github/workflows/nocobase-build-test.yml b/.github/workflows/nocobase-build-test.yml new file mode 100644 index 000000000..0a5ce0338 --- /dev/null +++ b/.github/workflows/nocobase-build-test.yml @@ -0,0 +1,34 @@ +name: Nocobase Build Test + +on: + push: + branches: + - 'main' + - 'develop' + paths: + - '.github/workflows/nocobase-build-test.yml' + - 'packages/**' + pull_request: + branches: + - '**' + paths: + - '.github/workflows/nocobase-build-test.yml' + - 'packages/**' + +jobs: + build-test: + strategy: + matrix: + node_version: [ '18' ] + runs-on: ubuntu-latest + container: node:${{ matrix.node_version }} + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node_version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node_version }} + cache: 'yarn' + - run: yarn install + - run: yarn build + timeout-minutes: 15 diff --git a/.github/workflows/nocobase-test-full.yml b/.github/workflows/nocobase-test-backend.yml similarity index 77% rename from .github/workflows/nocobase-test-full.yml rename to .github/workflows/nocobase-test-backend.yml index 6a86fc156..a54929bd5 100644 --- a/.github/workflows/nocobase-test-full.yml +++ b/.github/workflows/nocobase-test-backend.yml @@ -1,4 +1,4 @@ -name: NocoBase Test Full +name: NocoBase Backend Test on: push: @@ -11,6 +11,7 @@ on: - 'packages/core/database/**' - 'packages/core/server/**' - 'packages/plugins/**/src/server/**' + - '.github/workflows/nocobase-test-backend.yml' pull_request: paths: - 'packages/core/acl/**' @@ -18,30 +19,14 @@ on: - 'packages/core/database/**' - 'packages/core/server/**' - 'packages/plugins/**/src/server/**' + - '.github/workflows/nocobase-test-backend.yml' jobs: - build-test: - strategy: - matrix: - node_version: ['18'] - runs-on: ubuntu-latest - container: node:${{ matrix.node_version }} - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node_version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node_version }} - cache: 'yarn' - - run: yarn install - - run: yarn build - timeout-minutes: 15 - sqlite-test: strategy: matrix: - node_version: ['18'] - underscored: [true, false] + node_version: [ '18' ] + underscored: [ true, false ] runs-on: ubuntu-latest container: node:${{ matrix.node_version }} steps: @@ -53,7 +38,7 @@ jobs: cache: 'yarn' - run: yarn install - name: Test with Sqlite - run: yarn nocobase install -f && yarn test && yarn test:client + run: yarn nocobase install -f && yarn test env: DB_DIALECT: sqlite DB_STORAGE: /tmp/db.sqlite @@ -63,10 +48,10 @@ jobs: postgres-test: strategy: matrix: - node_version: ['18'] - underscored: [true, false] - schema: [public, nocobase] - collection_schema: [public, user_schema] + node_version: [ '18' ] + underscored: [ true, false ] + schema: [ public, nocobase ] + collection_schema: [ public, user_schema ] runs-on: ubuntu-latest container: node:${{ matrix.node_version }} services: @@ -94,7 +79,7 @@ jobs: - run: yarn install # - run: yarn build - name: Test with postgres - run: yarn nocobase install -f && yarn test && yarn test:client + run: yarn nocobase install -f && yarn test env: DB_DIALECT: postgres DB_HOST: postgres @@ -110,8 +95,8 @@ jobs: mysql-test: strategy: matrix: - node_version: ['18'] - underscored: [true, false] + node_version: [ '18' ] + underscored: [ true, false ] runs-on: ubuntu-latest container: node:${{ matrix.node_version }} services: @@ -131,7 +116,7 @@ jobs: - run: yarn install # - run: yarn build - name: Test with MySQL - run: yarn nocobase install -f && yarn test && yarn test:client + run: yarn nocobase install -f && yarn test env: DB_DIALECT: mysql DB_HOST: mysql diff --git a/.github/workflows/nocobase-test-frontend.yml b/.github/workflows/nocobase-test-frontend.yml new file mode 100644 index 000000000..ed61c12ae --- /dev/null +++ b/.github/workflows/nocobase-test-frontend.yml @@ -0,0 +1,42 @@ +name: NocoBase FrontEnd Test + +on: + push: + branches: + - main + - develop + paths: + - 'packages/**' + - '.github/workflows/nocobase-test-frontend.yml' + - '!packages/core/acl/**' + - '!packages/core/actions/**' + - '!packages/core/database/**' + - '!packages/core/server/**' + - '!packages/plugins/**/src/server/**' + pull_request: + paths: + - '.github/workflows/nocobase-test-frontend.yml' + - 'packages/**' + - '!packages/core/acl/**' + - '!packages/core/actions/**' + - '!packages/core/database/**' + - '!packages/core/server/**' + - '!packages/plugins/**/src/server/**' + +jobs: + frontend-test: + strategy: + matrix: + node_version: [ '18' ] + runs-on: ubuntu-latest + container: node:${{ matrix.node_version }} + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node_version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node_version }} + cache: 'yarn' + - run: yarn install + - run: yarn test:client + timeout-minutes: 15 diff --git a/.github/workflows/nocobase-test-lite.yml b/.github/workflows/nocobase-test-lite.yml deleted file mode 100644 index 30c573234..000000000 --- a/.github/workflows/nocobase-test-lite.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: NocoBase Test Lite - -on: - push: - branches: - - main - - develop - paths: - - 'packages/**' - - '!packages/core/acl/**' - - '!packages/core/actions/**' - - '!packages/core/database/**' - - '!packages/core/server/**' - - '!packages/plugins/**/src/server/**' - pull_request: - paths: - - 'packages/**' - - '!packages/core/acl/**' - - '!packages/core/actions/**' - - '!packages/core/database/**' - - '!packages/core/server/**' - - '!packages/plugins/**/src/server/**' - -jobs: - build-test: - strategy: - matrix: - node_version: ['18'] - runs-on: ubuntu-latest - container: node:${{ matrix.node_version }} - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node_version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node_version }} - cache: 'yarn' - - run: yarn install - - run: yarn build - timeout-minutes: 15 - - postgres-test: - strategy: - matrix: - node_version: ['18'] - runs-on: ubuntu-latest - container: node:${{ matrix.node_version }} - services: - # Label used to access the service container - postgres: - # Docker Hub image - image: postgres:10 - # 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: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node_version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node_version }} - cache: 'yarn' - - run: yarn install - - name: Test with postgres - run: yarn nocobase install -f && yarn test && yarn test:client - env: - DB_DIALECT: postgres - DB_HOST: postgres - DB_PORT: 5432 - DB_USER: nocobase - DB_PASSWORD: password - DB_DATABASE: nocobase - DB_UNDERSCORED: true - DB_SCHEMA: nocobase - COLLECTION_MANAGER_SCHEMA: user_schema - timeout-minutes: 30