-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (115 loc) · 3.67 KB
/
ci.yaml
File metadata and controls
136 lines (115 loc) · 3.67 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
name: ci
on:
push:
branches: [main]
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
pull_request:
permissions: read-all
env:
GO_VERSION: 1.25.7
jobs:
tidy:
name: tidy
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: ./.github/actions/setup-environment
- name: tidy
run: |
make tidy
if ! git diff --exit-code; then
echo "One or more Go files are not tidied. Run 'make tidy' and push the changes."
exit 1
fi
gofmt:
name: gofmt
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: ./.github/actions/setup-environment
- name: gofmt
run: |
make fmt
if ! git diff --exit-code; then
echo "One or more Go files are not formatted correctly. Run 'make fmt' and push the changes."
exit 1
fi
lint:
name: lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: ./.github/actions/setup-environment
- run: echo "GOLANGCI_LINT_CACHE=${HOME}/.cache/golangci-lint" >> "$GITHUB_ENV"
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: ${{ env.GOLANGCI_LINT_CACHE }}
key: golangci-lint-${{ hashFiles('**/.golangci.yml', '**/*.go', '**/go.sum') }}
- name: Lint
run: |
make lint
build:
timeout-minutes: 30
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: ./.github/actions/setup-environment
- name: Build
run: make build
test:
needs: [build]
timeout-minutes: 30
strategy:
matrix:
runner: ["ubuntu-24.04", "windows-latest"]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: ./.github/actions/setup-environment
- name: Tests
run: make test
coverage:
needs: [build]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: ./.github/actions/setup-environment
- name: Run Unit Tests With Coverage
run: COVER_TESTING=true make test-with-codecov
# TODO Wait for codecov to be enabled.
# - name: Upload coverage report
# uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # 5.5.1
# with:
# fail_ci_if_error: true
# verbose: true
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
publish-stable:
runs-on: ubuntu-24.04
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'splunk/tarunner'
needs: test
permissions:
contents: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Package
run: make package
- name: Prepare release notes
run: ./.github/workflows/scripts/prepare-release-notes.sh
env:
RELEASE_TAG: ${{ steps.github_tag.outputs.tag }}
- name: Build and push docker image
run: make docker-push
- name: Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
with:
body_path: release-notes.md
fail_on_unmatched_files: true
files: |
bin/**/*