-
Notifications
You must be signed in to change notification settings - Fork 1
148 lines (129 loc) · 4 KB
/
release.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
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
144
145
146
147
148
name: Release
on:
push:
branches:
- main
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.17
cache: false
- name: Run Lint
uses: golangci/golangci-lint-action@v3
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install codespell
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Check spelling with codespell
run: codespell --ignore-words=codespell.txt || exit 1
unit_test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.17
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Vet
run: make vet
- name: Test
run: make test
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: unit-go-${{ runner.os }}
parallel: true
path-to-lcov: ./covprofile
integration_test:
needs: [unit_test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.17
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run Integration Tests
run: make testacc
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: integration-go-${{ runner.os }}
parallel: true
path-to-lcov: ./covprofile
coverage:
needs: [unit_test, integration_test]
runs-on: ubuntu-latest
steps:
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
file: ./covprofile
release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
needs: [lint, codespell, integration_test]
outputs:
release_created: ${{ steps.release.outputs.release_created }}
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.DEVOPS_TOKEN }}
release-type: go
bootstrap-sha: 48eb0f97cddc5c2f6af991748a57c7142af15723
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"perf","section":"Performance Improvements","hidden":false},{"type":"docs","section":"Documentation","hidden":true},{"type":"test","section":"Tests","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false},{"type":"ci","section":"Miscellaneous","hidden":true}]'
- name: Push to Release Branch
if: ${{ steps.release.outputs.release_created }}
uses: actions/github-script@v6
env:
MAJOR_VERSION: ${{ steps.release.outputs.major }}
with:
github-token: ${{ secrets.DEVOPS_TOKEN }}
script: |
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${process.env.MAJOR_VERSION}-stable`,
sha: context.sha,
force: true
});