Skip to content

Commit 68debad

Browse files
Initial release of Instana Go client library
Initial release of Instana Go client library
2 parents 36a443a + 290fa55 commit 68debad

134 files changed

Lines changed: 20624 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/pull_request_template.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Checklist
2+
- [ ] I verified the changes locally
3+
- [ ] I added or updated tests if needed
4+
- [ ] I updated documentation if needed
5+
- [ ] I added user-friendly change details below
6+
7+
## Summary
8+
<!-- Short summary of the PR -->
9+
10+
## Description
11+
<!-- More context about what changed and why -->
12+
13+
## Changes
14+
<!--
15+
Uncomment the relevant bullets and add details.
16+
-->
17+
18+
### Enhancements
19+
<!-- Uncomment and fill in if applicable -->
20+
<!-- - Added support for ... -->
21+
<!-- - Improved ... -->
22+
23+
### Bug Fixes
24+
<!-- Uncomment and fill in if applicable -->
25+
<!-- - Fixed ... -->
26+
<!-- - Resolved ... -->

.github/workflows/ci.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Instana Go Client CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
lint:
12+
name: Lint
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '1.23'
23+
24+
- name: Run golangci-lint
25+
uses: golangci/golangci-lint-action@v8
26+
with:
27+
version: v2.1.0
28+
args: --timeout=5m
29+
30+
- name: Check code formatting
31+
run: |
32+
if [ -n "$(gofmt -l .)" ]; then
33+
echo "❌ Code is not formatted"
34+
gofmt -l .
35+
exit 1
36+
fi
37+
echo "✅ Code is properly formatted"
38+
39+
test:
40+
name: Test
41+
runs-on: ${{ matrix.os }}
42+
strategy:
43+
matrix:
44+
os: [ubuntu-latest, macos-latest, windows-latest]
45+
go-version: ['1.23'] # Only test minimum required version from go.mod
46+
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@v4
50+
51+
- name: Set up Go
52+
uses: actions/setup-go@v5
53+
with:
54+
go-version: ${{ matrix.go-version }}
55+
56+
- name: Cache Go modules
57+
uses: actions/cache@v4
58+
with:
59+
path: |
60+
~/go/pkg/mod
61+
~/.cache/go-build
62+
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
63+
restore-keys: |
64+
${{ runner.os }}-go-${{ matrix.go-version }}-
65+
66+
- name: Download dependencies
67+
run: go mod download
68+
69+
- name: Verify dependencies
70+
run: go mod verify
71+
72+
- name: Run tests
73+
shell: bash
74+
run: go test -v -race ./...
75+
76+
build:
77+
name: Build
78+
runs-on: ubuntu-latest
79+
80+
steps:
81+
- name: Checkout code
82+
uses: actions/checkout@v4
83+
84+
- name: Set up Go
85+
uses: actions/setup-go@v5
86+
with:
87+
go-version: '1.23'
88+
89+
- name: Build
90+
run: go build -v ./...
91+
92+
- name: Verify go.mod and go.sum
93+
run: |
94+
go mod tidy
95+
if [ -n "$(git diff go.mod go.sum)" ]; then
96+
echo "❌ go.mod or go.sum is not tidy"
97+
git diff go.mod go.sum
98+
exit 1
99+
fi
100+
echo "✅ go.mod and go.sum are tidy"
101+
102+
coverage-report:
103+
name: Coverage Report
104+
runs-on: ubuntu-latest
105+
needs: test
106+
107+
steps:
108+
- name: Checkout code
109+
uses: actions/checkout@v4
110+
111+
- name: Set up Go
112+
uses: actions/setup-go@v5
113+
with:
114+
go-version: '1.23'
115+
116+
- name: Generate coverage report
117+
shell: bash
118+
run: |
119+
go test -coverprofile=coverage.out -covermode=atomic ./...
120+
go tool cover -html=coverage.out -o coverage.html
121+
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}')
122+
echo "Coverage: ${COVERAGE}"
123+
124+
- name: Upload coverage report
125+
uses: actions/upload-artifact@v4
126+
with:
127+
name: coverage-report
128+
path: ./coverage.html
129+
130+
notify:
131+
name: Notify
132+
runs-on: ubuntu-latest
133+
needs: [lint, test, build, coverage-report]
134+
if: always()
135+
136+
steps:
137+
- name: Check job status
138+
run: |
139+
if [ "${{ needs.lint.result }}" == "failure" ] || \
140+
[ "${{ needs.test.result }}" == "failure" ] || \
141+
[ "${{ needs.build.result }}" == "failure" ] || \
142+
[ "${{ needs.coverage-report.result }}" == "failure" ]; then
143+
echo "❌ CI pipeline failed"
144+
echo "Lint: ${{ needs.lint.result }}"
145+
echo "Test: ${{ needs.test.result }}"
146+
echo "Build: ${{ needs.build.result }}"
147+
echo "Coverage: ${{ needs.coverage-report.result }}"
148+
exit 1
149+
else
150+
echo "✅ CI pipeline passed"
151+
fi
152+
153+

0 commit comments

Comments
 (0)