-
Notifications
You must be signed in to change notification settings - Fork 13
102 lines (89 loc) · 2.87 KB
/
ci.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
name: Tests
on:
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
branches:
- master
- docs/refine-readme
jobs:
build:
name: Test Build All Container Images
runs-on: ubuntu-latest
steps:
- name: Checkout Current Commit
uses: actions/checkout@v2
- name: Run Build All
run: make test-build-all
- name: Notify To Slack If Failed
uses: lazy-actions/[email protected]
if: failure()
with:
type: ${{ job.status }}
job_name: "*[hex-monscape]* ${{ github.job }}"
mention: "here"
mention_if: "failure"
channel: "#solutions-team-ci-cd"
icon_emoji: ":haraaj:"
username: "ci/cd-reporter"
url: ${{ secrets.SOLUTIONS_TEAM_SLACK_WEBHOOK }}
commit: true
token: ${{ secrets.GITHUB_TOKEN }}
test-coverage:
name: Run Tests & Code Coverage
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Current Commit
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Run Automated Tests
run: make test
- name: Install Go
uses: actions/[email protected]
- name: Install GOBadge
run: go install github.com/AlexBeauchemin/gobadge@latest
- name: Generate Coverage Badge
run: |
# generate coverage badge
gobadge \
-filename=./.tmp/cov-report/coverage.out \
-green=80 \
-target=README.md \
-text=coverage \
-link=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v12
id: verify-changed-files
with:
files: README.md
- name: Commit changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "chore: updated test coverage badge"
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.ref }}
- name: Notify To Slack If Failed
uses: lazy-actions/[email protected]
if: failure()
with:
type: ${{ job.status }}
job_name: "*[hex-monscape]* ${{ github.job }}"
mention: "here"
mention_if: "failure"
channel: "#solutions-team-ci-cd"
icon_emoji: ":haraaj:"
username: "ci/cd-reporter"
url: ${{ secrets.SOLUTIONS_TEAM_SLACK_WEBHOOK }}
commit: true
token: ${{ secrets.GITHUB_TOKEN }}