Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update ci/cd for api #307

Merged
merged 7 commits into from
Jul 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .github/workflows/api_cd.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/api_ci.yml
Original file line number Diff line number Diff line change
@@ -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 ./...
64 changes: 64 additions & 0 deletions .github/workflows/api_cicd.yml
Original file line number Diff line number Diff line change
@@ -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 }}
18 changes: 0 additions & 18 deletions .github/workflows/api_ut.yml

This file was deleted.