-
Notifications
You must be signed in to change notification settings - Fork 9
127 lines (105 loc) · 3.3 KB
/
unit-test.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
---
name: Unit Tests
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
permissions:
contents: read
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
test-image: ${{ steps.filter.outputs.test-image }}
steps:
- name: Repository checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
submodules: recursive
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50
id: filter
with:
filters: |
test-image:
- 'test/Dockerfile'
test:
needs: changes
if: ${{ needs.changes.outputs.test-image == 'false' }}
name: Test suite
runs-on: ubuntu-latest
container: ghcr.io/redhat-plumbers-in-action/differential-shellcheck/test:latest
permissions:
packages: read
steps:
- name: Repository checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
submodules: recursive
- name: Run tests using Kcov
run: |
set -x
bash --version
bats --version
kcov --version
kcov \
--clean \
--include-path . \
--exclude-path test/bats \
--exclude-path test/test_helper \
coverage/ \
bats test/*.bats
- name: Codecov - 1st attempt
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
id: upload_code_coverage_report
continue-on-error: true
with:
fail_ci_if_error: true
- name: Wait on failure 1
if: steps.upload_code_coverage_report.outcome == 'failure'
run: |
sleep 120s
- name: Codecov - 2nd attempt
if: steps.upload_code_coverage_report.outcome == 'failure'
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
with:
fail_ci_if_error: true
verbose: true
test-changes:
needs: changes
if: ${{ needs.changes.outputs.test-image == 'true' }}
name: Test suite - Local changes
runs-on: ubuntu-latest
steps:
- name: Repository checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
submodules: recursive
- name: Build test container using local changes
shell: bash
run: |
make build-test
- name: Run tests locally using container
shell: bash
run: |
make check
# There is some issue with code coverage inside the container
# TODO: Try to finger out how to run kcov inside container and retrieve coverage results
# - name: Codecov - 1st attempt
# uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
# id: upload_code_coverage_report
# continue-on-error: true
# with:
# fail_ci_if_error: true
# - name: Wait on failure 1
# if: steps.upload_code_coverage_report.outcome == 'failure'
# run: |
# sleep 120s
# - name: Codecov - 2nd attempt
# if: steps.upload_code_coverage_report.outcome == 'failure'
# uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
# with:
# fail_ci_if_error: true
# verbose: true
...