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

Add codecov to web ci #14

Closed
wants to merge 3 commits into from
Closed
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
31 changes: 13 additions & 18 deletions .github/workflows/web.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,23 @@ jobs:

- name: Install dependencies
run: |
npm install --legacy-peer-deps
npm install

- name: Test with Cypress
id: test
run: |
npx cypress run --component --headed --browser chrome

# # Set codecov branch name with prefix if pull request
# - name: Sets Codecov branch name
# run: |
# echo "CODECOV_BRANCH=PR_${{github.head_ref}}" >> $GITHUB_ENV
# if: github.event_name == 'pull_request'

# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# flags: epicsubmitweb
# name: codecov-submit-web
# fail_ci_if_error: true
# verbose: true
# override_branch: ${{env.CODECOV_BRANCH}}
# token: ${{ secrets.CODECOV_TOKEN }}
npx cypress run --component --headed --browser chrome \
--record --reporter @cypress/code-coverage

coverage-upload:
needs: testing # This job depends on the testing job being completed
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Upload coverage to Codecov (using @cypress/code-coverage)
run: |
npx @cypress/code-coverage upload --token=${{ secrets.CODECOV_TOKEN }}

build-check:
needs: setup-job
Expand Down
8 changes: 8 additions & 0 deletions submit-web/cypress.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,13 @@ module.exports = defineConfig({
framework: "react",
bundler: "vite",
},
setupNodeEvents(on, config) {
require('@cypress/code-coverage/task')(on, config)
// include any other plugin code...

// It's IMPORTANT to return the config object
// with any changed environment variables
return config
},
},
});
1 change: 1 addition & 0 deletions submit-web/cypress/support/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import './commands'
// require('./commands')

import { mount } from 'cypress/react18'
import '@cypress/code-coverage/support'

// Augment the Cypress namespace to include type definitions for
// your custom command.
Expand Down
Loading
Loading