| name: Frontend e2e test |
| |
| on: |
| push: |
| branches: |
| - master |
| paths-ignore: |
| - 'docs/**' |
| pull_request: |
| branches: |
| - master |
| paths-ignore: |
| - 'docs/**' |
| |
| concurrency: |
| group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} |
| cancel-in-progress: true |
| |
| env: |
| CYPRESS_CACHE_FOLDER: cypress/cache |
| defaults: |
| run: |
| working-directory: web |
| |
| jobs: |
| web-e2e: |
| name: Frontend e2e test |
| strategy: |
| fail-fast: false |
| matrix: |
| folderPrefix: ['consumer', 'route', 'plugin', 'rest'] |
| runs-on: ubuntu-latest |
| services: |
| etcd: |
| image: bitnami/etcd:3.5.2 |
| ports: |
| - 2379:2379 |
| - 2380:2380 |
| env: |
| ALLOW_NONE_AUTHENTICATION: yes |
| |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v3 |
| with: |
| submodules: recursive |
| |
| - name: Setup Node.js environment |
| uses: actions/setup-node@v3 |
| with: |
| node-version: 16.x |
| cache: 'yarn' |
| cache-dependency-path: web/yarn.lock |
| |
| - name: Setup golang environment |
| uses: actions/setup-go@v3 |
| with: |
| go-version: '1.18' |
| |
| - uses: actions/cache@v3 |
| with: |
| path: | |
| ~/.cache/go-build |
| ~/go/pkg/mod |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| restore-keys: | |
| ${{ runner.os }}-go- |
| |
| - name: Start manager-api |
| working-directory: ./ |
| run: | |
| make dag-lib |
| cd api |
| sed -i 's@# - dubbo-proxy@- dubbo-proxy@' ./conf/conf.yaml |
| nohup go run ./main.go & |
| |
| - name: Cache Cypress binary |
| uses: actions/cache@v3 |
| 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 |
| run: yarn |
| |
| - name: Start frontend then test |
| run: | |
| yarn start-server-and-test 'cross-env SERVE_ENV=test yarn start' http-get://localhost:8000 'cross-env CYPRESS_SERVE_ENV=test yarn cypress run --spec "**/integration/${{matrix.folderPrefix}}/**.spec.js"' |
| |
| - 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 |
| |
| - name: Archive code coverage results |
| uses: actions/upload-artifact@v3 |
| if: always() |
| with: |
| name: cypress-report-${{matrix.folderPrefix}} |
| path: | |
| web/cypress/videos |
| web/cypress/screenshots |
| retention-days: 5 |