Skip to content

Commit

Permalink
Merge branch 'master' into fix-#1586-plugin-button-enable-status
Browse files Browse the repository at this point in the history
  • Loading branch information
juzhiyuan committed Apr 12, 2021
2 parents 11a14fb + c68e2d2 commit e9a8d9f
Show file tree
Hide file tree
Showing 114 changed files with 4,279 additions and 1,936 deletions.
15 changes: 15 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
titleOnly: true
types:
- feat
- fix
- docs
- style
- refactor
- perf
- test
- build
- ci
- chore
- revert
- change
- backport
39 changes: 31 additions & 8 deletions .github/workflows/frontend-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:
branches:
- master
env:
CYPRESS_CACHE_FOLDER: cypress/cache
defaults:
run:
working-directory: web
Expand All @@ -15,7 +17,6 @@ jobs:
web-e2e:
name: Frontend e2e test
runs-on: ubuntu-latest

services:
etcd:
image: bitnami/etcd:3.4.13
Expand All @@ -28,7 +29,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js environment
uses: actions/setup-node@v2.1.5
with:
Expand All @@ -37,31 +37,54 @@ jobs:
- name: Setup golang environment
uses: actions/setup-go@v2.1.3
with:
go-version: "1.13"
go-version: '1.13'

- name: Start manager-api
working-directory: ./api
run: |
sed -i 's@# - dubbo-proxy@- dubbo-proxy@' ./conf/conf.yaml
nohup go run ./cmd/manager &
- name: Install front-end dependencies
run: yarn install
- name: Cache node_modules
uses: actions/cache@v2.1.4
id: yarn-cache
with:
path: '*/node_modules'
key: '${{ runner.os }}-yarn-cache0-${{ hashFiles(''**/yarn.lock'') }}'
restore-keys: |
${{ runner.os }}-yarn-cache0
- name: Cache Cypress binary
uses: actions/cache@v2.1.4
id: cypress-binary-cache
with:
path: '*/cypress/cache'
key: cypress-${{ runner.os }}-cypress-cache0-${{ hashFiles('**/package.json') }}
restore-keys: |
cypress-${{ runner.os }}-cypress-cache0
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn

- name: Start frontend then test
run: yarn test:e2e
run: |
rm -rf cypress/integration/plugin
yarn test:e2e
- name: Report e2e coverage
run: npx nyc report --reporter=text-summary

- name: Upload coverage to Codecov
run: |
bash <(curl -s https://codecov.io/bash) -f ./coverage/coverage-final.json -F frontend-e2e-test
bash <(curl -s https://codecov.io/bash) -f ./coverage/coverage-final.json -F frontend-e2e-test
- name: Archive code coverage results
uses: actions/upload-artifact@v2
if: always()
with:
name: cypress-report
path: web/cypress/
path: |
web/cypress/videos
web/cypress/screenshots
retention-days: 5
79 changes: 79 additions & 0 deletions .github/workflows/frontend-plugin-e2e-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Frontend e2e test for plugin
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
CYPRESS_CACHE_FOLDER: cypress/cache
defaults:
run:
working-directory: web

jobs:
web-e2e:
name: Frontend e2e test
runs-on: ubuntu-latest
services:
etcd:
image: bitnami/etcd:3.4.13
ports:
- 2379:2379
- 2380:2380
env:
ALLOW_NONE_AUTHENTICATION: yes
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.5
with:
node-version: 14.x

- name: Setup golang environment
uses: actions/setup-go@v2.1.3
with:
go-version: '1.13'

- name: Start manager-api
working-directory: ./api
run: |
sed -i 's@# - dubbo-proxy@- dubbo-proxy@' ./conf/conf.yaml
nohup go run ./cmd/manager &
- name: Cache node_modules
uses: actions/cache@v2.1.4
id: yarn-cache
with:
path: '*/node_modules'
key: '${{ runner.os }}-yarn-cache0-${{ hashFiles(''**/yarn.lock'') }}'
restore-keys: |
${{ runner.os }}-yarn-cache0
- name: Cache Cypress binary
uses: actions/cache@v2.1.4
id: cypress-binary-cache
with:
path: '*/cypress/cache'
key: cypress-${{ runner.os }}-cypress-cache0-${{ hashFiles('**/package.json') }}
restore-keys: |
cypress-${{ runner.os }}-cypress-cache0
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn

- name: Start frontend then test
run: yarn test-plugin:e2e

- name: Archive code coverage results
uses: actions/upload-artifact@v2
if: always()
with:
name: cypress-report
path: |
web/cypress/videos
web/cypress/screenshots
retention-days: 5
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ build
manager-api

output
apisix_logs
default.etcd
api/build-tools/apisix
/*.zip
.githash
.backup.yaml
Dockerfile-apisix

# backend unit test output
api/coverage.txt
Expand Down
3 changes: 3 additions & 0 deletions api/internal/handler/route_online_debug/route_online_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type DebugOnlineInput struct {

type Result struct {
Code int `json:"code,omitempty"`
Header interface{} `json:"header,omitempty"`
Message string `json:"message,omitempty"`
Data interface{} `json:"data,omitempty"`
}
Expand Down Expand Up @@ -142,10 +143,12 @@ func (h *HTTPProtocolSupport) RequestForwarding(c droplet.Context) (interface{},
err = json.Unmarshal(_body, &returnData)
if err != nil {
result.Code = resp.StatusCode
result.Header = resp.Header
result.Message = resp.Status
result.Data = string(_body)
} else {
result.Code = resp.StatusCode
result.Header = resp.Header
result.Message = resp.Status
result.Data = returnData
}
Expand Down
12 changes: 2 additions & 10 deletions api/test/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,7 @@ services:

apisix:
hostname: apisix_server1
build:
context: ../../
dockerfile: test/docker/Dockerfile-apisix
args:
- APISIX_VERSION=2.4
image: apache/apisix:2.4-alpine
restart: always
volumes:
- ./apisix_config.yaml:/usr/local/apisix/conf/config.yaml:ro
Expand All @@ -152,11 +148,7 @@ services:

apisix2:
hostname: apisix_server2
build:
context: ../../
dockerfile: test/docker/Dockerfile-apisix
args:
- APISIX_VERSION=2.4
image: apache/apisix:2.4-alpine
restart: always
volumes:
- ./apisix_config2.yaml:/usr/local/apisix/conf/config.yaml:ro
Expand Down
3 changes: 0 additions & 3 deletions api/test/e2e/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ func BatchTestServerPort(t *testing.T, times int) map[string]int {
for i := 0; i < times; i++ {
client = &http.Client{}
resp, err = client.Do(req)
if err != nil {
fmt.Printf("err: %s", err)
}
assert.Nil(t, err)

bodyByte, err = ioutil.ReadAll(resp.Body)
Expand Down
Loading

0 comments on commit e9a8d9f

Please sign in to comment.