-
Notifications
You must be signed in to change notification settings - Fork 5
71 lines (58 loc) · 1.91 KB
/
Copy pathCI.yml
File metadata and controls
71 lines (58 loc) · 1.91 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
name: CI
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master, develop]
permissions:
contents: write
jobs:
CI:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
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.
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Verify dependencies
run: |
go mod verify
- name: Validate module graph
run: |
go mod tidy
git diff --exit-code go.mod go.sum
- name: Build
run: make build
- name: SWAP
run: |
sudo swapon -s
export PARTITION=$(sudo swapon -s | tail -n 1 | gawk '{print $1;}')
sudo swapoff $PARTITION
sudo swapon -s
- name: Test
run: make test_coverage
- name: Go Coverage Badge # Pass the `coverage.out` output to this action
uses: tj-actions/coverage-badge-go@v3
with:
filename: coverage.out
- name: Verify changed files
uses: tj-actions/verify-changed-files@v20
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 "action@github.com"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "chore: Updated coverage badge."
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@v1.0.0
with:
github_token: ${{ github.token }}
branch: ${{ github.head_ref || github.ref_name }}