chore: improve ci (#976)

* test: ci

* fix: ci error

* fix: on pull_request

* fix: paths

* fix: paths 'packages/**'
# Conflicts:
#	.github/workflows/nocobase-test.yml
This commit is contained in:
chenos 2022-10-28 11:41:48 +08:00
parent f477d80de4
commit 274d80d501
4 changed files with 61 additions and 24 deletions

View File

@ -1,9 +1,11 @@
name: push-acr name: Aliyun Container Registry
on: on:
push: pull_request:
branches: branches:
- '**' - '**'
paths:
- 'packages/**'
jobs: jobs:
push-acr: push-acr:

View File

@ -1,9 +1,11 @@
name: main-docker name: Docker Hub
on: on:
push: push:
branches: branches:
- 'main' - 'main'
paths:
- 'packages/**'
jobs: jobs:
push-docker: push-docker:
@ -51,6 +53,6 @@ jobs:
file: Dockerfile file: Dockerfile
build-args: | build-args: |
VERDACCIO_URL=http://localhost:4873/ VERDACCIO_URL=http://localhost:4873/
platforms: linux/amd64,linux/arm64 # platforms: linux/amd64,linux/arm64
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}

View File

@ -1,21 +1,45 @@
name: Nocobase test name: NocoBase Test
on: on:
push: push:
branches: branches:
- main - main
- develop - develop
paths-ignore: paths:
- 'docs/**' - 'packages/**'
# paths-ignore:
# - 'docs/**'
pull_request: pull_request:
paths-ignore: paths:
- 'docs/**' - 'packages/**'
# paths-ignore:
# - 'docs/**'
jobs: jobs:
test: sqlite-test:
strategy: strategy:
matrix: 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 runs-on: ubuntu-latest
container: node:${{ matrix.node_version }} container: node:${{ matrix.node_version }}
@ -34,13 +58,6 @@ jobs:
--health-interval 10s --health-interval 10s
--health-timeout 5s --health-timeout 5s
--health-retries 5 --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: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node_version }} - name: Use Node.js ${{ matrix.node_version }}
@ -49,7 +66,6 @@ jobs:
node-version: ${{ matrix.node_version }} node-version: ${{ matrix.node_version }}
cache: 'yarn' cache: 'yarn'
- run: yarn install - run: yarn install
# - run: yarn build
- name: Test with postgres - name: Test with postgres
run: yarn test run: yarn test
env: env:
@ -59,11 +75,28 @@ jobs:
DB_USER: nocobase DB_USER: nocobase
DB_PASSWORD: password DB_PASSWORD: password
DB_DATABASE: nocobase 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: env:
DB_DIALECT: sqlite MYSQL_ROOT_PASSWORD: password
DB_STORAGE: /tmp/db.sqlite 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 - name: Test with MySQL
run: yarn test run: yarn test
env: env:

View File

@ -1,4 +1,4 @@
name: release-ci name: Release
on: on:
push: push: