Skip to content

Commit 2e29dfc

Browse files
committed
ci: Add CI workflow for testing and building Telegraf with DDS support
1 parent 2e7f76e commit 2e29dfc

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

.github/workflows/ci.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v4
20+
with:
21+
go-version: '1.21'
22+
23+
- name: Cache Go modules
24+
uses: actions/cache@v3
25+
with:
26+
path: ~/go/pkg/mod
27+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-go-
30+
31+
- name: Download RTI Connector libraries
32+
run: |
33+
go run github.com/rticommunity/rticonnextdds-connector-go/cmd/download-libs@latest
34+
35+
- name: Set library path
36+
run: |
37+
echo "LD_LIBRARY_PATH=$(pwd)/rticonnextdds-connector/lib/linux-x64:$LD_LIBRARY_PATH" >> $GITHUB_ENV
38+
39+
- name: Run tests
40+
run: go test -v ./...
41+
42+
- name: Build Telegraf (standard)
43+
run: go build ./cmd/telegraf
44+
45+
- name: Build Telegraf with DDS support
46+
run: go build -tags dds ./cmd/telegraf
47+
48+
- name: Verify DDS plugin is available
49+
run: ./telegraf --input-list | grep dds_consumer
50+
51+
- name: Test DDS configuration syntax
52+
run: ./telegraf --config plugins/inputs/dds_consumer/example_telegraf.conf --test
53+
54+
build-matrix:
55+
name: Build Matrix
56+
runs-on: ${{ matrix.os }}
57+
strategy:
58+
matrix:
59+
os: [ubuntu-latest, macos-latest, windows-latest]
60+
go-version: ['1.20', '1.21']
61+
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v4
65+
66+
- name: Set up Go
67+
uses: actions/setup-go@v4
68+
with:
69+
go-version: ${{ matrix.go-version }}
70+
71+
- name: Download RTI Connector libraries
72+
run: |
73+
go run github.com/rticommunity/rticonnextdds-connector-go/cmd/download-libs@latest
74+
75+
- name: Set library path (Linux)
76+
if: runner.os == 'Linux'
77+
run: |
78+
echo "LD_LIBRARY_PATH=$(pwd)/rticonnextdds-connector/lib/linux-x64:$LD_LIBRARY_PATH" >> $GITHUB_ENV
79+
80+
- name: Set library path (macOS)
81+
if: runner.os == 'macOS'
82+
run: |
83+
echo "DYLD_LIBRARY_PATH=$(pwd)/rticonnextdds-connector/lib/osx-x64:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
84+
85+
- name: Set library path (Windows)
86+
if: runner.os == 'Windows'
87+
run: |
88+
echo "PATH=$(pwd)/rticonnextdds-connector/lib/win-x64;$env:PATH" >> $env:GITHUB_ENV
89+
90+
- name: Build Telegraf with DDS support
91+
run: go build -tags dds ./cmd/telegraf
92+
93+
- name: Verify DDS plugin is available
94+
run: ./telegraf --input-list | grep dds_consumer
95+
96+
lint:
97+
name: Lint
98+
runs-on: ubuntu-latest
99+
100+
steps:
101+
- name: Checkout code
102+
uses: actions/checkout@v4
103+
104+
- name: Set up Go
105+
uses: actions/setup-go@v4
106+
with:
107+
go-version: '1.21'
108+
109+
- name: Run golangci-lint
110+
uses: golangci/golangci-lint-action@v3
111+
with:
112+
version: latest
113+
args: --timeout=5m

0 commit comments

Comments
 (0)