-
Notifications
You must be signed in to change notification settings - Fork 117
64 lines (54 loc) · 1.88 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
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Go
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Build
run: go build -v ./...
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-2go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-2go-
- name: Run Test
env:
WALLET_SEED: ${{ secrets.WALLET_SEED }}
run: |
go test -v $(go list ./... | grep -v /example/) -covermode=count -coverprofile=coverage.out
go tool cover -func=coverage.out -o=coverage.out
- name: Go Coverage Badge # Pass the `coverage.out` output to this action
uses: tj-actions/coverage-badge-go@v1.2
with:
filename: coverage.out
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v17
id: verify-changed-files
with:
files: README.md
- name: Commit changes
if: steps.verify-changed-files.outputs.files_changed == 'true' && github.ref != 'refs/heads/master'
run: |
git add README.md
git config --global user.email "coverage@tonutils.com"
git config --global user.name "Coverage"
git commit -m "Updated coverage badge"
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true' && github.ref != 'refs/heads/master'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.head_ref }}