-
Notifications
You must be signed in to change notification settings - Fork 5
66 lines (56 loc) · 2.34 KB
/
tests.yml
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
65
66
---
name: tests
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "18.18"
cache: "yarn"
- name: Install dependencies
run: yarn
- name: Run Tests
if: github.event_name != 'pull_request'
continue-on-error: true
id: run-tests
run: yarn test --coverage --collectCoverageFrom="./src/**" > /tmp/coverage_report
- name: Post Test Coverage Report in PR
uses: ArtiomTr/jest-coverage-report-action@v2
continue-on-error: true
if: github.event_name == 'pull_request'
with:
test-script: yarn test --collectCoverageFrom="./src/**"
annotations: all
- name: Gain access to test-reports bucket
if: (steps.run-tests.outcome == 'failure' || steps.run-tests.outcome == 'success') && github.ref == 'refs/heads/develop'
uses: google-github-actions/setup-gcloud@v0
with:
project_id: "netdata-cloud-testing"
service_account_key: ${{ secrets.TEST_AUTOMATION_SERVICE_ACCOUNT }}
export_default_credentials: true
- name: Upload report to test-reports bucket
if: (steps.run-tests.outcome == 'failure' || steps.run-tests.outcome == 'success') && github.ref == 'refs/heads/develop'
run: |
gsutil -h "Cache-Control: max-age=0, no-store" cp \
/tmp/coverage_report gs://${{ secrets.TEST_AUTOMATION_STORAGE_BUCKET }}/${{ github.event.repository.name }}/coverage_report
gsutil acl set project-private gs://${{ secrets.TEST_AUTOMATION_STORAGE_BUCKET }}/${{ github.event.repository.name }}/coverage_report
- name: Publish test coverage report
if: (steps.run-tests.outcome == 'failure' || steps.run-tests.outcome == 'success') && github.ref == 'refs/heads/develop'
uses: aurelien-baudet/workflow-dispatch@v2
with:
repo: netdata/cloud-workflows
ref: refs/heads/main
workflow: test_coverage_publisher.yml
token: ${{ secrets.TEST_AUTOMATION_TOKEN }}
inputs: '{ "service-name": "${{ github.event.repository.name }}"}'