-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (143 loc) · 4.72 KB
/
Copy pathci.yml
File metadata and controls
177 lines (143 loc) · 4.72 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: CI/CD Pipeline
on:
pull_request:
branches: [main]
push:
branches: [main]
release:
types: [published]
permissions:
contents: write
env:
GO_VERSION: "1.24.x"
jobs:
test:
name: Test and Quality Checks
runs-on: ${{ matrix.os }}
if: github.event_name == 'pull_request' || github.event_name == 'push'
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go-version: ["1.24.x"]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
${{ runner.os }}-go-
- name: Install development tools
run: make install-tools
- name: Download dependencies
run: make deps
- name: Verify dependencies
run: go mod verify
- name: Format check
run: make fmt-check
- name: Vet code
run: make vet
- name: Run golangci-lint
run: make lint
- name: Run tests
run: make test-ci
- name: Run tests with coverage
run: make test-coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
if: matrix.os == 'ubuntu-latest'
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
fail_ci_if_error: true
files: ./junit-unit.xml
name: task-engine-tests
token: ${{ secrets.CODECOV_TOKEN }}
release-validation:
name: Release Validation
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install development tools
run: make install-tools
- name: Run tests before release
run: make test-ci
- name: Run linting before release
run: make lint
- name: Validate library builds
run: |
# Validate that the library can be built successfully
go build ./...
- name: Create release documentation
run: |
VERSION=${{ github.event.release.tag_name }}
COMMIT_SHA=${{ github.sha }}
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "# Task Engine Release ${VERSION}" > release-info.md
echo "" >> release-info.md
echo "- **Version**: ${VERSION}" >> release-info.md
echo "- **Commit**: ${COMMIT_SHA}" >> release-info.md
echo "- **Build Date**: ${BUILD_DATE}" >> release-info.md
echo "- **Go Version**: ${{ env.GO_VERSION }}" >> release-info.md
echo "" >> release-info.md
echo "## Installation" >> release-info.md
echo "" >> release-info.md
echo '```bash' >> release-info.md
echo "go get github.com/ndizazzo/task-engine@${VERSION}" >> release-info.md
echo '```' >> release-info.md
echo "" >> release-info.md
echo "## Compatibility" >> release-info.md
echo "" >> release-info.md
echo "This release has been tested on:" >> release-info.md
echo "- **Operating Systems**: Linux, macOS" >> release-info.md
echo "- **Go Versions**: ${{ env.GO_VERSION }}+" >> release-info.md
- name: Upload release documentation
uses: softprops/action-gh-release@v2
with:
files: release-info.md
generate_release_notes: true
draft: false
prerelease: false
security-scan:
name: Security Scan
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install development tools
run: make install-tools
- name: Run security and vulnerability scans
run: make security