-
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (44 loc) · 1.22 KB
/
go.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
name: Build and test app
on:
pull_request:
paths:
- '**.go'
push:
paths:
- '**.go'
branches:
- main
tags-ignore:
- '**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
id: go
- name: Run tests
run: go test -race -count=1 -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
- name: Build app
id: build_go_app
run: |
go build -v .
echo ::set-output name=exit_code::$?
- name: Notify Slack on success
if: steps.build_go_app.outputs.exit_code == 0
id: slack_notification
uses: ravsamhq/notify-slack-action@v1
with:
status: ${{ job.status }}
notification_title: 'Build succeeded'
message_format: 'Statoo build succeeded. <{repo_url}|{repo}@{branch}> on <{commit_url}|{commit_sha}>'
footer: 'repo: <{repo_url}|{repo}>'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}