You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/07/12 04:55:33 UTC
[incubator-apisix-dashboard] branch master updated: update ci/cd
for api (#307)
This is an automated email from the ASF dual-hosted git repository.
juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new e788bc4 update ci/cd for api (#307)
e788bc4 is described below
commit e788bc44fa08020a4f7cbb0f43caaf78560dde18
Author: nic-chen <33...@users.noreply.github.com>
AuthorDate: Sun Jul 12 12:55:24 2020 +0800
update ci/cd for api (#307)
* update github actions for api ci cd
* fix: working-directory
* fix error
* fix: step name
* fix: mysql config for github action
* test
* use default config
---
.github/workflows/api_cd.yml | 23 ---------------
.github/workflows/api_ci.yml | 58 ++++++++++++++++++++++++++++++++++++++
.github/workflows/api_cicd.yml | 64 ++++++++++++++++++++++++++++++++++++++++++
.github/workflows/api_ut.yml | 18 ------------
4 files changed, 122 insertions(+), 41 deletions(-)
diff --git a/.github/workflows/api_cd.yml b/.github/workflows/api_cd.yml
deleted file mode 100644
index a2e0cfb..0000000
--- a/.github/workflows/api_cd.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-name: API CD
-
-on:
- push:
- branches:
- - master
-
-jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
-
- - uses: Azure/docker-login@v1
- with:
- login-server: apisixacr.azurecr.cn
- username: ${{ secrets.REGISTRY_USERNAME }}
- password: ${{ secrets.REGISTRY_PASSWORD }}
-
- - run: |
- cd ./api
- docker build . -t apisixacr.azurecr.cn/managerapi:${{ github.sha }}
- docker push apisixacr.azurecr.cn/managerapi:${{ github.sha }}
diff --git a/.github/workflows/api_ci.yml b/.github/workflows/api_ci.yml
new file mode 100644
index 0000000..ec906da
--- /dev/null
+++ b/.github/workflows/api_ci.yml
@@ -0,0 +1,58 @@
+name: API CI
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ branches:
+ - master
+
+jobs:
+
+ run-test:
+
+ runs-on: ubuntu-latest
+
+ services:
+ etcd:
+ image: bitnami/etcd:3.3.13-r80
+ ports:
+ - 2379:2379
+ - 2380:2380
+ env:
+ ALLOW_NONE_AUTHENTICATION: yes
+
+ apisix:
+ image: johz/apisix:v1.4-github-action
+ env:
+ APISIX_ETCD_HOST: http://etcd:2379
+ ports:
+ - 9080:9080
+
+ mysql:
+ image: mysql:8.0
+ env:
+ MYSQL_ROOT_PASSWORD: 123456
+ ports:
+ - '3306:3306'
+ options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
+
+
+ steps:
+
+ - uses: actions/checkout@v2
+
+ - name: setting up database
+ run: |
+ mysql -h 127.0.0.1 --port 3306 -u root -p123456 < ./api/script/db/schema.sql
+
+ - name: setup go
+ uses: actions/setup-go@v1
+ with:
+ go-version: '1.13'
+
+ - name: run test
+ working-directory: ./api
+ run: |
+ go test ./...
diff --git a/.github/workflows/api_cicd.yml b/.github/workflows/api_cicd.yml
new file mode 100644
index 0000000..a906135
--- /dev/null
+++ b/.github/workflows/api_cicd.yml
@@ -0,0 +1,64 @@
+name: API CI && CD
+
+on:
+ push:
+ branches:
+ - master
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ services:
+ etcd:
+ image: bitnami/etcd:3.3.13-r80
+ ports:
+ - 2379:2379
+ - 2380:2380
+ env:
+ ALLOW_NONE_AUTHENTICATION: yes
+
+ apisix:
+ image: johz/apisix:v1.4-github-action
+ env:
+ APISIX_ETCD_HOST: http://etcd:2379
+ ports:
+ - 9080:9080
+
+ mysql:
+ image: mysql:8.0
+ env:
+ MYSQL_ROOT_PASSWORD: 123456
+ ports:
+ - '3306:3306'
+ options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
+
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: setting up database
+ run: |
+ mysql -h 127.0.0.1 --port 3306 -u root -p123456 < ./api/script/db/schema.sql
+
+ - name: setup go
+ uses: actions/setup-go@v1
+ with:
+ go-version: '1.13'
+
+ - name: run test
+ working-directory: ./api
+ run: |
+ go test ./...
+
+ - uses: Azure/docker-login@v1
+ with:
+ login-server: apisixacr.azurecr.cn
+ username: ${{ secrets.REGISTRY_USERNAME }}
+ password: ${{ secrets.REGISTRY_PASSWORD }}
+
+ - name: build and push docker image
+ run: |
+ cd ./api
+ docker build . -t apisixacr.azurecr.cn/managerapi:${{ github.sha }}
+ docker push apisixacr.azurecr.cn/managerapi:${{ github.sha }}
diff --git a/.github/workflows/api_ut.yml b/.github/workflows/api_ut.yml
deleted file mode 100644
index 2b3c4bb..0000000
--- a/.github/workflows/api_ut.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-name: API unit test
-
-on:
- push:
- branches:
- - master
- - manager
- pull_request:
- branches:
- - master
-
-jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - name: use docker-compose in api
- run: cd ./api && docker-compose up
\ No newline at end of file