-
Notifications
You must be signed in to change notification settings - Fork 176
147 lines (126 loc) · 4.21 KB
/
build-and-test.yml
File metadata and controls
147 lines (126 loc) · 4.21 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
name: build-and-test
on:
push:
branches:
- main
pull_request:
workflow_dispatch: # Allows manual execution of the workflow
concurrency:
group: build-and-test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GO_VERSION: 1.25.7
jobs:
tidy:
name: tidy
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-environment
- name: tidy
run: |
make tidy-all
if ! git diff --exit-code; then
echo "One or more Go files are not tidied. Run 'make tidy-all' and push the changes."
exit 1
fi
gofmt:
name: gofmt
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-environment
- name: gofmt
run: |
make fmt-all
if ! git diff --exit-code; then
echo "One or more Go files are not formatted correctly. Run 'make fmt-all' and push the changes."
exit 1
fi
generate-metrics:
name: generate-metrics
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-environment
- name: generate-metrics
run: |
make generate-metrics
if ! git diff --exit-code; then
echo "Generated code is out of date. Run 'make generate-metrics' and push the changes."
exit 1
fi
lint:
name: lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-environment
- run: echo "GOLANGCI_LINT_CACHE=${HOME}/.cache/golangci-lint" >> "$GITHUB_ENV"
- uses: actions/cache@v5
with:
path: ${{ env.GOLANGCI_LINT_CACHE }}
key: golangci-lint-${{ hashFiles('**/.golangci.yml', '**/*.go', '**/go.sum') }}
- name: Lint
run: |
make lint-all
actionlint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/0933c14/scripts/download-actionlint.bash) # v1.7.10
shell: bash
- name: Check workflow files
run: ${{ steps.get_actionlint.outputs.executable }} -color
shell: bash
test:
name: test-${{ matrix.OS }}-race_detection:${{ matrix.TEST_RACE }}-coverage:${{ !matrix.TEST_RACE }}
strategy:
matrix:
OS: [ "ubuntu-24.04", "macos-14", "macos-15", "windows-2025", "windows-11-arm" ]
TEST_RACE: [ true, false ]
exclude:
- OS: "windows-11-arm"
TEST_RACE: true
uses: ./.github/workflows/reusable-unit-test.yml
with:
OS: ${{ matrix.OS }}
COVERAGE: ${{ !matrix.TEST_RACE }} # No coverage when running with race
TEST_RACE: ${{ matrix.TEST_RACE }}
secrets: inherit
coverage:
name: coverage
runs-on: ubuntu-24.04
steps:
- name: Free up disk space for next step
uses: jlumbroso/free-disk-space@v1.3.1
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-environment
- name: Run Unit Tests With Coverage
run: COVER_TESTING=true make gotest-with-codecov
- name: Upload coverage report
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # 5.5.2
with:
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
cross-compile:
strategy:
matrix:
SYS_BINARIES: [ "binaries-darwin_amd64", "binaries-darwin_arm64", "binaries-linux_amd64", "binaries-linux_arm64", "binaries-windows_amd64", "binaries-windows_arm64", "binaries-linux_ppc64le" ]
uses: ./.github/workflows/reusable-compile.yml
with:
SYS_BINARY: ${{ matrix.SYS_BINARIES }}
latest-dockerd-test:
# Run this as a separate test to avoid affecting other tests with the dockerd upgrade.
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-environment
- name: dockerd test
working-directory: ./internal/signalfx-agent/pkg/monitors/docker
run: |
go test -v -tags=dockerd -timeout 3m ./...