From 274d80d501277495b1292eab043df86ba0c70ffc Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 28 Oct 2022 11:41:48 +0800 Subject: [PATCH] chore: improve ci (#976) * test: ci * fix: ci error * fix: on pull_request * fix: paths * fix: paths 'packages/**' # Conflicts: # .github/workflows/nocobase-test.yml --- ...-acr.yml => aliyun-container-registry.yml} | 6 +- .../{main-docker.yml => docker-hub.yml} | 6 +- .../{node-ci.yml => nocobase-test.yml} | 71 ++++++++++++++----- .../workflows/{release-ci.yml => release.yml} | 2 +- 4 files changed, 61 insertions(+), 24 deletions(-) rename .github/workflows/{push-acr.yml => aliyun-container-registry.yml} (94%) rename .github/workflows/{main-docker.yml => docker-hub.yml} (93%) rename .github/workflows/{node-ci.yml => nocobase-test.yml} (63%) rename .github/workflows/{release-ci.yml => release.yml} (99%) diff --git a/.github/workflows/push-acr.yml b/.github/workflows/aliyun-container-registry.yml similarity index 94% rename from .github/workflows/push-acr.yml rename to .github/workflows/aliyun-container-registry.yml index 4cd3bc248..3e5c4b583 100644 --- a/.github/workflows/push-acr.yml +++ b/.github/workflows/aliyun-container-registry.yml @@ -1,9 +1,11 @@ -name: push-acr +name: Aliyun Container Registry on: - push: + pull_request: branches: - '**' + paths: + - 'packages/**' jobs: push-acr: diff --git a/.github/workflows/main-docker.yml b/.github/workflows/docker-hub.yml similarity index 93% rename from .github/workflows/main-docker.yml rename to .github/workflows/docker-hub.yml index 6b81cc5a5..b608a8701 100644 --- a/.github/workflows/main-docker.yml +++ b/.github/workflows/docker-hub.yml @@ -1,9 +1,11 @@ -name: main-docker +name: Docker Hub on: push: branches: - 'main' + paths: + - 'packages/**' jobs: push-docker: @@ -51,6 +53,6 @@ jobs: file: Dockerfile build-args: | VERDACCIO_URL=http://localhost:4873/ - platforms: linux/amd64,linux/arm64 + # platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file diff --git a/.github/workflows/node-ci.yml b/.github/workflows/nocobase-test.yml similarity index 63% rename from .github/workflows/node-ci.yml rename to .github/workflows/nocobase-test.yml index e8330d68a..91de994e4 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/nocobase-test.yml @@ -1,21 +1,45 @@ -name: Nocobase test +name: NocoBase Test on: push: branches: - main - develop - paths-ignore: - - 'docs/**' + paths: + - 'packages/**' + # paths-ignore: + # - 'docs/**' pull_request: - paths-ignore: - - 'docs/**' + paths: + - 'packages/**' + # paths-ignore: + # - 'docs/**' jobs: - test: + sqlite-test: strategy: matrix: - node_version: ['14'] + node_version: ['16'] + 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 + - name: Test with Sqlite + run: yarn test + env: + DB_DIALECT: sqlite + DB_STORAGE: /tmp/db.sqlite + + postgres-test: + strategy: + matrix: + node_version: ['16'] runs-on: ubuntu-latest container: node:${{ matrix.node_version }} @@ -34,13 +58,6 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - mysql: - image: mysql:8 - env: - MYSQL_ROOT_PASSWORD: password - MYSQL_DATABASE: nocobase - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node_version }} @@ -49,7 +66,6 @@ jobs: node-version: ${{ matrix.node_version }} cache: 'yarn' - run: yarn install - # - run: yarn build - name: Test with postgres run: yarn test env: @@ -59,11 +75,28 @@ jobs: DB_USER: nocobase DB_PASSWORD: password DB_DATABASE: nocobase - - name: Test with Sqlite - run: yarn test + + mysql-test: + strategy: + matrix: + node_version: ['16'] + runs-on: ubuntu-latest + container: node:${{ matrix.node_version }} + services: + mysql: + image: mysql:8 env: - DB_DIALECT: sqlite - DB_STORAGE: /tmp/db.sqlite + MYSQL_ROOT_PASSWORD: password + MYSQL_DATABASE: nocobase + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + 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 MySQL run: yarn test env: diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release.yml similarity index 99% rename from .github/workflows/release-ci.yml rename to .github/workflows/release.yml index f1f01b92e..50d305b2e 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: release-ci +name: Release on: push: