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

chore: reduce FE e2e ci time #1698

Merged
merged 8 commits into from
Apr 3, 2021
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
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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the formatting has been changed. The official documentation for this place uses single quotes, so let's leave it as it is, probably having changed the formatting wrong before.

image


- 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
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
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
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-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
4 changes: 3 additions & 1 deletion web/cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"viewportWidth": 1920,
"viewportHeight": 1080,
"baseUrl": "http://localhost:8000",
"video": true
"video": true,
"numTestsKeptInMemory": 0,
juzhiyuan marked this conversation as resolved.
Show resolved Hide resolved
"videoUploadOnPasses": false
}
4 changes: 3 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down