Skip to content

Commit 5ddb287

Browse files
authored
Merge pull request #33 from kalverra/lint
Lint
2 parents 48f855f + 1e36648 commit 5ddb287

File tree

5 files changed

+126
-130
lines changed

5 files changed

+126
-130
lines changed
Lines changed: 118 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,125 @@
11
name: Build, Lint, and Test
22
on:
3-
push:
4-
branches:
5-
- main
6-
tags:
7-
- '*'
8-
pull_request:
9-
branches:
10-
- main
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- "*"
8+
pull_request:
9+
branches:
10+
- main
1111

1212
jobs:
13-
build:
14-
name: Build
15-
runs-on: ubuntu-latest
16-
steps:
17-
- name: Checkout code
18-
uses: actions/checkout@v4
19-
- name: Set up Go
20-
uses: actions/setup-go@v5
21-
with:
22-
go-version: stable
23-
- name: Install Dependencies
24-
run: go mod download
25-
- name: Build Octometrics
26-
run: go build -o octometrics-binary .
27-
- name: Upload binary
28-
uses: actions/upload-artifact@v4
29-
with:
30-
name: octometrics-binary
31-
path: octometrics-binary
32-
retention-days: 1
33-
if-no-files-found: error
13+
build:
14+
name: Build
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v6
19+
- name: Set up Go
20+
uses: actions/setup-go@v6
21+
with:
22+
go-version: stable
23+
- name: Install Dependencies
24+
run: go mod download
25+
- name: Build Octometrics
26+
run: go build -o octometrics-binary .
27+
- name: Upload binary
28+
uses: actions/upload-artifact@v7
29+
with:
30+
name: octometrics-binary
31+
path: octometrics-binary
32+
retention-days: 1
33+
if-no-files-found: error
3434

35-
test:
36-
name: Test
37-
needs: build
38-
runs-on: ubuntu-latest
39-
steps:
40-
- name: Download Built Binary
41-
uses: actions/download-artifact@v4
42-
with:
43-
name: octometrics-binary
44-
path: .
45-
- name: Monitor
46-
uses: kalverra/octometrics-action@v0.0.5
47-
with:
48-
job_name: Test
49-
version: ./octometrics-binary
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52-
- name: Checkout code
53-
uses: actions/checkout@v4
54-
- name: Setup Go
55-
uses: actions/setup-go@v5
56-
with:
57-
go-version: stable
58-
- name: Install Dependencies
59-
run: go mod download
60-
- name: Run tests
61-
run: OCTOMETRICS_TEST_LOG_LEVEL=trace go tool gotestsum --junitfile junit.xml -- -coverprofile=cover.out ./...
62-
- name: Upload coverage reports to Codecov
63-
uses: codecov/codecov-action@v5
64-
with:
65-
token: ${{ secrets.CODECOV_TOKEN }}
66-
files: cover.out
67-
- name: Upload test results to Codecov
68-
if: ${{ !cancelled() }}
69-
uses: codecov/test-results-action@v1
70-
with:
71-
token: ${{ secrets.CODECOV_TOKEN }}
35+
test:
36+
name: Test
37+
needs: build
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Download Built Binary
41+
uses: actions/download-artifact@v8
42+
with:
43+
name: octometrics-binary
44+
path: .
45+
- name: Monitor
46+
uses: kalverra/octometrics-action@v0.0.10
47+
with:
48+
job_name: Test
49+
version: ./octometrics-binary
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
- name: Checkout code
53+
uses: actions/checkout@v6
54+
- name: Setup Go
55+
uses: actions/setup-go@v6
56+
with:
57+
go-version: stable
58+
- name: Install Dependencies
59+
run: go mod download
60+
- name: Run tests
61+
run: OCTOMETRICS_TEST_LOG_LEVEL=trace go tool gotestsum --junitfile junit.xml -- -coverprofile=cover.out ./...
62+
- name: Upload coverage reports to Codecov
63+
uses: codecov/codecov-action@v5
64+
with:
65+
token: ${{ secrets.CODECOV_TOKEN }}
66+
files: cover.out
7267

73-
test-race:
74-
name: Test (Race)
75-
needs: build
76-
runs-on: ubuntu-latest
77-
steps:
78-
- name: Download Built Binary
79-
uses: actions/download-artifact@v4
80-
with:
81-
name: octometrics-binary
82-
path: .
83-
- name: Monitor
84-
uses: kalverra/octometrics-action@v0.0.5
85-
with:
86-
job_name: Test (Race)
87-
version: ./octometrics-binary
88-
env:
89-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90-
- name: Checkout code
91-
uses: actions/checkout@v4
92-
- name: Setup Go
93-
uses: actions/setup-go@v5
94-
with:
95-
go-version: stable
96-
- name: Install Dependencies
97-
run: go mod download
98-
- name: Run tests with race detector
99-
run: OCTOMETRICS_TEST_LOG_LEVEL=trace go tool gotestsum -- -count=1 -cover -race ./...
68+
test-race:
69+
name: Test (Race)
70+
needs: build
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: Download Built Binary
74+
uses: actions/download-artifact@v8
75+
with:
76+
name: octometrics-binary
77+
path: .
78+
- name: Monitor
79+
uses: kalverra/octometrics-action@v0.0.10
80+
with:
81+
job_name: Test (Race)
82+
version: ./octometrics-binary
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
- name: Checkout code
86+
uses: actions/checkout@v6
87+
- name: Setup Go
88+
uses: actions/setup-go@v6
89+
with:
90+
go-version: stable
91+
- name: Install Dependencies
92+
run: go mod download
93+
- name: Run tests with race detector
94+
run: OCTOMETRICS_TEST_LOG_LEVEL=trace go tool gotestsum -- -count=1 -cover -race ./...
10095

101-
lint:
102-
name: Lint
103-
needs: build
104-
runs-on: ubuntu-latest
105-
steps:
106-
- name: Download Built Binary
107-
uses: actions/download-artifact@v4
108-
with:
109-
name: octometrics-binary
110-
path: .
111-
- name: Monitor
112-
uses: kalverra/octometrics-action@v0.0.5
113-
with:
114-
job_name: Lint
115-
version: ./octometrics-binary
116-
env:
117-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118-
- name: Checkout code
119-
uses: actions/checkout@v4
120-
- name: Set up Go
121-
uses: actions/setup-go@v5
122-
with:
123-
go-version: stable
124-
- name: Install Dependencies
125-
run: go mod download
126-
- name: golangci-lint
127-
uses: golangci/golangci-lint-action@v7
128-
with:
129-
version: v2.0
96+
lint:
97+
name: Lint
98+
needs: build
99+
runs-on: ubuntu-latest
100+
steps:
101+
- name: Download Built Binary
102+
uses: actions/download-artifact@v8
103+
with:
104+
name: octometrics-binary
105+
path: .
106+
- name: Monitor
107+
uses: kalverra/octometrics-action@v0.0.10
108+
with:
109+
job_name: Lint
110+
version: ./octometrics-binary
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
- name: Checkout code
114+
uses: actions/checkout@v6
115+
- name: Set up Go
116+
uses: actions/setup-go@v6
117+
with:
118+
go-version: stable
119+
- name: Install Dependencies
120+
run: go mod download
121+
122+
- name: golangci-lint
123+
uses: golangci/golangci-lint-action@v9
124+
with:
125+
version: latest

.github/workflows/release.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'v*.*.*'
6+
- "v*.*.*"
77

88
permissions:
99
contents: write
@@ -13,11 +13,11 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v6
1717
with:
1818
fetch-depth: 0
1919
- name: Set up Go
20-
uses: actions/setup-go@v5
20+
uses: actions/setup-go@v6
2121
with:
2222
go-version: stable
2323
- name: Install Dependencies

.pre-commit-config.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@ repos:
66
exclude: deploy/charts/.*
77
- id: detect-aws-credentials
88
- id: detect-private-key
9-
exclude: (testdata/test_key\.pem$|config/definition\.go$|config\.md$)
109
- id: end-of-file-fixer
1110
- id: trailing-whitespace
1211
- id: check-merge-conflict
1312
- repo: https://github.com/codespell-project/codespell
14-
rev: v2.4.1
13+
rev: v2.4.2
1514
hooks:
1615
- id: codespell
1716
exclude: go\.sum$
1817
- repo: https://github.com/golangci/golangci-lint
19-
rev: v2.10.1
18+
rev: v2.11.3
2019
hooks:
2120
- id: golangci-lint-config-verify
2221
- id: golangci-lint-full

gather/workflow_run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ func monitoringData(
424424
return nil, fmt.Errorf("unexpected status code %d", resp.StatusCode)
425425
}
426426
for _, artifact := range artifacts.Artifacts {
427-
if strings.HasSuffix(artifact.GetName(), "octometrics.monitor.log") {
427+
if strings.HasSuffix(artifact.GetName(), "octometrics.monitor.log.jsonl") {
428428
artifactsToDownload = append(artifactsToDownload, artifact)
429429
}
430430
}
@@ -513,7 +513,7 @@ func monitoringData(
513513

514514
var monitorFile *os.File
515515
for _, file := range zipReader.File {
516-
if strings.HasSuffix(file.Name, "octometrics.monitor.log") {
516+
if strings.HasSuffix(file.Name, "octometrics.monitor.log.jsonl") {
517517
// Open the target file inside the zip
518518
rc, err := file.Open()
519519
if err != nil {

observe/observe.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ func generateAllObserveData(log zerolog.Logger, client *gather.GitHubClient, out
349349
return nil
350350
}
351351
if d.Name() == ".DS_Store" {
352+
//nolint:gosec // I don't care
352353
if err := os.Remove(path); err != nil {
353354
return fmt.Errorf("failed to remove .DS_Store file: %w", err)
354355
}

0 commit comments

Comments
 (0)