-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (128 loc) · 4 KB
/
Copy pathgo.yml
File metadata and controls
143 lines (128 loc) · 4 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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# This workflow will build, lint and test a golang project.
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Analyse, lint, test & release
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
jobs:
#################################################
# Run a static analysis
#################################################
# analyse:
# name: Perform static analysis
# runs-on: ubuntu-22.04
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# token: ${{ github.token }}
#
# - name: Set up Go
# uses: actions/setup-go@v5
# with:
# go-version: 1.23.x
#
# - name: Static analysis
# uses: dominikh/staticcheck-action@v1.3.1
# with:
# version: 2024.1.1
#################################################
# Run various linters
#################################################
lint:
name: Analyse & Lint
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
token: ${{ github.token }}
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.11
#################################################
# Run tests
#################################################
test:
name: Test
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
token: ${{ github.token }}
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Unit Tests
run: go test -race -vet=off -v ./...
#################################################
# Update version tag
#################################################
semver-bump:
name: Increment the version
needs: [lint, test]
runs-on: ubuntu-24.04
outputs:
next-version: ${{ steps.semver.outputs.next }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Calculate next version
id: semver
uses: ietf-tools/semver-action@v1
with:
token: ${{ github.token }}
branch: main
majorList: "build!, ci!, docs!, feat!, fix!, perf!, refactor!, style!, test!"
minorList: "feat, docs"
patchList: "fix, perf, refactor, test, ci, build"
noNewCommitBehavior: silent
noVersionBumpBehavior: silent
- name: Push next version tag
uses: thejeff77/action-push-tag@v1.0.0
with:
tag: ${{ steps.semver.outputs.next }}
message: "${{ steps.semver.outputs.next }}"
#################################################
# Update changelog and release
#################################################
release:
name: Create a new release
needs: [semver-bump]
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1.10.3
with:
token: ${{ github.token }}
tag: ${{ needs.semver-bump.outputs.next-version }}
- name: Create Release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: false
makeLatest: true
prerelease: false
name: ${{ needs.semver-bump.outputs.next-version }}
tag: ${{ needs.semver-bump.outputs.next-version }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v7
with:
branch: main
commit_message: "docs: update CHANGELOG.md for ${{ needs.semver-bump.outputs.next-version }} [skip ci]"
file_pattern: CHANGELOG.md