fix: fix chromatic action #796
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: test-coverage | |
on: | |
push: | |
branches: [main, release, test-code-coverage] | |
pull_request: | |
branches: [main, release] | |
workflow_dispatch: | |
jobs: | |
jest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Run install | |
run: npm i -g lerna@^6 && npm run bootstrap | |
- name: Run Jest test | |
run: npm run test:coverage | |
- name: Archive Jest coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
name: jest | |
path: test/coverage/coverage-final.json | |
cypress: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Run install | |
run: | | |
npm i -g lerna@^6 | |
npm run bootstrap | |
- name: Build storybook | |
run: | | |
npm run pre-story | |
TEST_ENV=test npm run build-storybook | |
- name: Serve storybook | |
run: nohup npx http-server -p 6006 storybook-static & | |
- name: Run Cypress test | |
run: npx wait-on http://127.0.0.1:6006 && ./node_modules/.bin/cypress run | |
- name: Archive Cypress coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
name: cypress | |
path: cypress/coverage/coverage-final.json | |
coverage: | |
runs-on: ubuntu-latest | |
needs: [jest, cypress] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Download Jest coverage | |
uses: actions/download-artifact@v3 | |
with: | |
# upload jest and cypress coverage to output dir | |
path: output | |
- name: Code coverage merge | |
run: | | |
tree output | |
npx istanbul-merge --out output/coverage-final.json output/jest/coverage-final.json output/cypress/coverage-final.json | |
tree output | |
- name: Run codecov | |
run: npx codecov --token=${{ secrets.CODECOV_TOKEN }} --file=output/coverage-final.json |