This repository was archived by the owner on Jan 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (54 loc) · 2.15 KB
/
ci-cd.yml
File metadata and controls
64 lines (54 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: CI/CD
on: [push]
jobs:
test:
name: Continuous Integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: '14'
# Take advantage of smart caching built into Cypress GH action to install
# dependencies
- name: Install dependencies
uses: cypress-io/github-action@v2
with:
runTests: false # Just perform install
- name: 'Test: Lint'
run: npm run test:lint
- name: 'Test: Unit'
run: npm run test:unit
- name: 'Test: E2E'
uses: cypress-io/github-action@v2
with:
# Prefix Cypress command with Percy command for screenshots
command-prefix: 'percy exec -- npx'
install: false
record: true
start: npm run start:instrument
wait-on: 'http://localhost:3000'
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Allows accurately detecting a build vs a re-run build
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
- name: 'Code Climate: Report'
if: success()
run: |
export GIT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF:11}}"
export GIT_COMMIT="${GIT_COMMIT_SHA}"
# Fetch Code Climate binary
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
# Notify Code Climate of the pending report
./cc-test-reporter before-build
# Format and merge unit and e2e coverage reports
./cc-test-reporter format-coverage -t lcov -o coverage/codeclimate.cypress.json coverage_cypress/lcov.info
./cc-test-reporter format-coverage -t lcov -o coverage/codeclimate.jest.json coverage_jest/lcov.info
./cc-test-reporter sum-coverage coverage/codeclimate.*.json -p 2
# Send final report to Code Climate
./cc-test-reporter upload-coverage
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}