forked from nephio-project/porch
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (63 loc) · 1.73 KB
/
sonar-ci-artifacts.yaml
File metadata and controls
72 lines (63 loc) · 1.73 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
65
66
67
68
69
70
71
72
name: CI test report
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
check-changes:
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
code:
- '!docs/**'
build:
runs-on: ubuntu-latest
needs: check-changes
if: needs.check-changes.outputs.code == 'true'
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
# Disabling shallow clones is recommended for improving the relevancy of reporting
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run unit tests to generate coverage report
id: test
run: make test
- name: Archive test results
if: steps.test.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ./coverage.out
- name: Save PR number to file
if: github.event_name == 'pull_request'
run: echo ${{ github.event.number }} > PR_NUMBER.txt
- name: Archive PR number
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: PR_NUMBER
path: PR_NUMBER.txt
test-summary:
name: Test Summary
if: always()
needs: [check-changes, build]
runs-on: ubuntu-latest
steps:
- run: exit 1
if: |
needs.check-changes.outputs.code == 'true' &&
(needs.build.result == 'failure' || needs.build.result == 'cancelled')
- run: echo "Tests passed or skipped"