This is an automated email from the ASF dual-hosted git repository.
shuyangw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 297a57a chore: reduce FE e2e ci time (#1698)
297a57a is described below
commit 297a57a4081b7b55d7906f6084d319d0afc21579
Author: litesun <[email protected]>
AuthorDate: Sat Apr 3 17:04:37 2021 +0800
chore: reduce FE e2e ci time (#1698)
---
.github/workflows/frontend-e2e-test.yml | 39 +++++++++++++++----
...d-e2e-test.yml => frontend-plugin-e2e-test.yml} | 44 ++++++++++++++--------
web/cypress.json | 4 +-
web/package.json | 4 +-
4 files changed, 65 insertions(+), 26 deletions(-)
diff --git a/.github/workflows/frontend-e2e-test.yml
b/.github/workflows/frontend-e2e-test.yml
index 0b92f9c..98e76c6 100644
--- a/.github/workflows/frontend-e2e-test.yml
+++ b/.github/workflows/frontend-e2e-test.yml
@@ -7,6 +7,8 @@ on:
pull_request:
branches:
- master
+env:
+ CYPRESS_CACHE_FOLDER: cypress/cache
defaults:
run:
working-directory: web
@@ -15,7 +17,6 @@ jobs:
web-e2e:
name: Frontend e2e test
runs-on: ubuntu-latest
-
services:
etcd:
image: bitnami/etcd:3.4.13
@@ -28,7 +29,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
-
- name: Setup Node.js environment
uses: actions/[email protected]
with:
@@ -37,7 +37,7 @@ jobs:
- name: Setup golang environment
uses: actions/[email protected]
with:
- go-version: "1.13"
+ go-version: '1.13'
- name: Start manager-api
working-directory: ./api
@@ -45,23 +45,46 @@ jobs:
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
+ 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
+ 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
diff --git a/.github/workflows/frontend-e2e-test.yml
b/.github/workflows/frontend-plugin-e2e-test.yml
similarity index 53%
copy from .github/workflows/frontend-e2e-test.yml
copy to .github/workflows/frontend-plugin-e2e-test.yml
index 0b92f9c..d919299 100644
--- a/.github/workflows/frontend-e2e-test.yml
+++ b/.github/workflows/frontend-plugin-e2e-test.yml
@@ -1,5 +1,4 @@
-name: Frontend e2e test
-
+name: Frontend e2e test for plugin
on:
push:
branches:
@@ -7,6 +6,8 @@ on:
pull_request:
branches:
- master
+env:
+ CYPRESS_CACHE_FOLDER: cypress/cache
defaults:
run:
working-directory: web
@@ -15,7 +16,6 @@ jobs:
web-e2e:
name: Frontend e2e test
runs-on: ubuntu-latest
-
services:
etcd:
image: bitnami/etcd:3.4.13
@@ -24,11 +24,9 @@ jobs:
- 2380:2380
env:
ALLOW_NONE_AUTHENTICATION: yes
-
steps:
- name: Checkout
uses: actions/checkout@v2
-
- name: Setup Node.js environment
uses: actions/[email protected]
with:
@@ -37,7 +35,7 @@ jobs:
- name: Setup golang environment
uses: actions/[email protected]
with:
- go-version: "1.13"
+ go-version: '1.13'
- name: Start manager-api
working-directory: ./api
@@ -45,23 +43,37 @@ jobs:
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
+ id: yarn-cache
+ with:
+ path: '*/node_modules'
+ key: '${{ runner.os }}-yarn-cache0-${{ hashFiles(''**/yarn.lock'')
}}'
+ restore-keys: |
+ ${{ runner.os }}-yarn-cache0
- - name: Start frontend then test
- run: yarn test:e2e
+ - name: Cache Cypress binary
+ uses: actions/cache@v2
+ 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: Report e2e coverage
- run: npx nyc report --reporter=text-summary
+ - name: Install dependencies
+ if: steps.yarn-cache.outputs.cache-hit != 'true'
+ run: yarn
- - name: Upload coverage to Codecov
- run: |
- bash <(curl -s https://codecov.io/bash) -f
./coverage/coverage-final.json -F frontend-e2e-test
+ - 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/
+ path: |
+ web/cypress/videos
+ web/cypress/screenshots
retention-days: 5
diff --git a/web/cypress.json b/web/cypress.json
index 753aa48..db84cd7 100644
--- a/web/cypress.json
+++ b/web/cypress.json
@@ -2,5 +2,7 @@
"viewportWidth": 1920,
"viewportHeight": 1080,
"baseUrl": "http://localhost:8000",
- "video": true
+ "video": true,
+ "numTestsKeptInMemory": 0,
+ "videoUploadOnPasses": false
}
diff --git a/web/package.json b/web/package.json
index a98a193..f138a1b 100644
--- a/web/package.json
+++ b/web/package.json
@@ -22,6 +22,7 @@
"start": "umi dev",
"start:e2e": "cross-env SERVE_ENV=test umi dev",
"test:e2e": "start-server-and-test 'cross-env SERVE_ENV=test yarn start'
http-get://localhost:8000 cypress:run-ci",
+ "test-plugin:e2e": "start-server-and-test 'cross-env SERVE_ENV=test yarn
start' http-get://localhost:8000 cypress:run-plugin-ci",
"start:dev": "cross-env REACT_APP_ENV=dev MOCK=none umi dev",
"start:no-mock": "cross-env MOCK=none umi dev",
"start:no-ui": "cross-env UMI_UI=none umi dev",
@@ -31,7 +32,8 @@
"tsc": "tsc",
"cypress:open": "cross-env CYPRESS_SERVE_ENV=test cypress open",
"cypress:open-dev": "cross-env CYPRESS_SERVE_ENV=dev cypress open",
- "cypress:run-ci": "cross-env CYPRESS_SERVE_ENV=test cypress run"
+ "cypress:run-ci": "cross-env CYPRESS_SERVE_ENV=test cypress run",
+ "cypress:run-plugin-ci": "cross-env CYPRESS_SERVE_ENV=test cypress run
--spec 'cypress/integration/plugin/*.spec.js'"
},
"license": "Apache-2.0",
"lint-staged": {