66# Copyright (c) 2024-2026 DevOpsCorner Indonesia. All rights reserved.
77#
88# This workflow runs tests and linting for the TelemetryFlow Python SDK:
9- # - Unit tests
10- # - Integration tests
11- # - Linting with ruff and mypy
12- # - Code coverage
9+ # - Unit tests (via Makefile)
10+ # - Integration tests (via Makefile)
11+ # - Linting with ruff and mypy (via Makefile)
12+ # - Code coverage (via Makefile)
13+ #
14+ # Compatible with TFO-Collector v1.1.2 (OCB-native)
1315#
1416# =============================================================================
1517
2830 - ' tests/**'
2931 - ' pyproject.toml'
3032 - ' requirements*.txt'
33+ - ' Makefile'
3134 - ' .github/workflows/ci.yml'
3235 pull_request :
3336 branches :
3942 - ' tests/**'
4043 - ' pyproject.toml'
4144 - ' requirements*.txt'
45+ - ' Makefile'
4246 workflow_dispatch :
4347 inputs :
4448 run_e2e :
5559env :
5660 PYTHON_VERSION : ' 3.12'
5761 PRODUCT_NAME : TelemetryFlow Python SDK
62+ VERSION : ' 1.1.2'
63+ TFO_COLLECTOR_VERSION : ' 1.1.2'
5864
5965permissions :
6066 contents : read
@@ -63,7 +69,7 @@ permissions:
6369
6470jobs :
6571 # ===========================================================================
66- # Code Quality - Lint, Format, Type Check
72+ # Code Quality - Lint, Format, Type Check (via Makefile)
6773 # ===========================================================================
6874 lint :
6975 name : Lint & Code Quality
@@ -79,23 +85,17 @@ jobs:
7985 python-version : ${{ env.PYTHON_VERSION }}
8086 cache : ' pip'
8187
82- - name : Install dependencies
83- run : |
84- python -m pip install --upgrade pip
85- pip install -e ".[dev]"
86-
87- - name : Check formatting with ruff
88- run : ruff format --check src/ tests/
88+ - name : Install CI dependencies
89+ run : make ci-deps
8990
90- - name : Run ruff linter
91- run : ruff check src/ tests/
91+ - name : Show version info
92+ run : make version
9293
93- - name : Run mypy type checker
94- run : mypy src/ --ignore-missing-imports
95- continue-on-error : true
94+ - name : Run CI lint suite
95+ run : make ci-lint
9696
9797 # ===========================================================================
98- # Unit Tests
98+ # Unit Tests (via Makefile)
9999 # ===========================================================================
100100 test-unit :
101101 name : Unit Tests (Python ${{ matrix.python-version }})
@@ -116,25 +116,24 @@ jobs:
116116 python-version : ${{ matrix.python-version }}
117117 cache : ' pip'
118118
119- - name : Install dependencies
120- run : |
121- python -m pip install --upgrade pip
122- pip install -e ".[dev]"
119+ - name : Install CI dependencies
120+ run : make ci-deps
123121
124- - name : Run unit tests
125- run : |
126- pytest tests/unit/ -v --cov=src/telemetryflow --cov-report=xml --cov-report=term-missing
122+ - name : Run unit tests (CI mode)
123+ run : make ci-test-unit
127124
128125 - name : Upload coverage report
129126 if : matrix.python-version == '3.12'
130127 uses : actions/upload-artifact@v4
131128 with :
132129 name : coverage-unit
133- path : coverage.xml
130+ path : |
131+ coverage-unit.xml
132+ junit-unit.xml
134133 retention-days : 7
135134
136135 # ===========================================================================
137- # Integration Tests
136+ # Integration Tests (via Makefile)
138137 # ===========================================================================
139138 test-integration :
140139 name : Integration Tests
@@ -151,20 +150,19 @@ jobs:
151150 python-version : ${{ env.PYTHON_VERSION }}
152151 cache : ' pip'
153152
154- - name : Install dependencies
155- run : |
156- python -m pip install --upgrade pip
157- pip install -e ".[dev]"
153+ - name : Install CI dependencies
154+ run : make ci-deps
158155
159- - name : Run integration tests
160- run : |
161- pytest tests/integration/ -v --cov=src/telemetryflow --cov-report=xml --cov-append || true
156+ - name : Run integration tests (CI mode)
157+ run : make ci-test-integration
162158
163159 - name : Upload coverage report
164160 uses : actions/upload-artifact@v4
165161 with :
166162 name : coverage-integration
167- path : coverage.xml
163+ path : |
164+ coverage-integration.xml
165+ junit-integration.xml
168166 retention-days : 7
169167 continue-on-error : true
170168
@@ -186,17 +184,15 @@ jobs:
186184 python-version : ${{ env.PYTHON_VERSION }}
187185 cache : ' pip'
188186
189- - name : Install dependencies
190- run : |
191- python -m pip install --upgrade pip
192- pip install -e ".[dev]"
187+ - name : Install CI dependencies
188+ run : make ci-deps
193189
194190 - name : Run E2E tests
195191 run : |
196192 pytest tests/e2e/ -v || true
197193
198194 # ===========================================================================
199- # Build Verification - CLI Generators
195+ # Build Verification - CLI Generators (via Makefile)
200196 # ===========================================================================
201197 build :
202198 name : Build & Verify (${{ matrix.os }})
@@ -217,11 +213,20 @@ jobs:
217213 python-version : ${{ env.PYTHON_VERSION }}
218214 cache : ' pip'
219215
220- - name : Install package
216+ - name : Install package (Unix)
217+ if : matrix.os != 'windows-latest'
218+ run : make deps
219+
220+ - name : Install package (Windows)
221+ if : matrix.os == 'windows-latest'
221222 run : |
222223 python -m pip install --upgrade pip
223224 pip install -e "."
224225
226+ - name : Show version info (Unix)
227+ if : matrix.os != 'windows-latest'
228+ run : make version
229+
225230 - name : Verify CLI generators (Unix)
226231 if : matrix.os != 'windows-latest'
227232 run : |
@@ -259,7 +264,7 @@ jobs:
259264 dir $env:TEMP\test-restapi\test-api
260265
261266 # ===========================================================================
262- # Security Scan
267+ # Security Scan (via Makefile)
263268 # ===========================================================================
264269 security :
265270 name : Security Scan
@@ -276,29 +281,21 @@ jobs:
276281 python-version : ${{ env.PYTHON_VERSION }}
277282 cache : ' pip'
278283
279- - name : Install dependencies
280- run : |
281- python -m pip install --upgrade pip
282- pip install bandit safety pip-audit
284+ - name : Install CI dependencies
285+ run : make ci-deps
283286
284- - name : Run Bandit security linter
285- run : |
286- bandit -r src/ -f sarif -o bandit-results.sarif || true
287+ - name : Run security scan (CI mode)
288+ run : make ci-security
287289
288290 - name : Upload Bandit SARIF
289291 uses : github/codeql-action/upload-sarif@v4
290292 if : always()
291293 with :
292- sarif_file : bandit-results.sarif
293- continue-on-error : true
294-
295- - name : Run pip-audit
296- run : |
297- pip-audit --ignore-vuln PYSEC-2024-48 || true
294+ sarif_file : bandit-results.json
298295 continue-on-error : true
299296
300297 # ===========================================================================
301- # Coverage Report
298+ # Coverage Report (via Makefile)
302299 # ===========================================================================
303300 coverage :
304301 name : Coverage Report
@@ -315,23 +312,30 @@ jobs:
315312 python-version : ${{ env.PYTHON_VERSION }}
316313 cache : ' pip'
317314
318- - name : Install dependencies
319- run : |
320- python -m pip install --upgrade pip
321- pip install coverage
315+ - name : Install CI dependencies
316+ run : make ci-deps
322317
323- - name : Download unit coverage
324- uses : actions/download-artifact@v4
318+ - name : Generate coverage report (CI mode)
319+ run : make ci-coverage
320+
321+ - name : Upload HTML coverage report
322+ uses : actions/upload-artifact@v4
325323 with :
326- name : coverage-unit
327- path : coverage/
324+ name : coverage-html
325+ path : htmlcov/
326+ retention-days : 7
328327 continue-on-error : true
329328
330329 - name : Coverage summary
331330 run : |
332331 echo "## Coverage Summary" >> $GITHUB_STEP_SUMMARY
333- if [ -f coverage/coverage .xml ]; then
332+ if [ -f coverage.xml ]; then
334333 echo "Coverage report generated successfully" >> $GITHUB_STEP_SUMMARY
334+ echo "" >> $GITHUB_STEP_SUMMARY
335+ echo "### TFO v2 API Features Tested:" >> $GITHUB_STEP_SUMMARY
336+ echo "- v2 endpoints: /v2/traces, /v2/metrics, /v2/logs" >> $GITHUB_STEP_SUMMARY
337+ echo "- Collector identity (tfoidentityextension)" >> $GITHUB_STEP_SUMMARY
338+ echo "- Auth headers (tfoauthextension)" >> $GITHUB_STEP_SUMMARY
335339 else
336340 echo "No coverage report available" >> $GITHUB_STEP_SUMMARY
337341 fi
@@ -347,7 +351,9 @@ jobs:
347351 steps :
348352 - name : Generate summary
349353 run : |
350- echo "## ${{ env.PRODUCT_NAME }} - CI Results" >> $GITHUB_STEP_SUMMARY
354+ echo "## ${{ env.PRODUCT_NAME }} v${{ env.VERSION }} - CI Results" >> $GITHUB_STEP_SUMMARY
355+ echo "" >> $GITHUB_STEP_SUMMARY
356+ echo "**TFO-Collector Version:** ${{ env.TFO_COLLECTOR_VERSION }}" >> $GITHUB_STEP_SUMMARY
351357 echo "" >> $GITHUB_STEP_SUMMARY
352358 echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY
353359 echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY
@@ -358,6 +364,11 @@ jobs:
358364 echo "| Security | ${{ needs.security.result }} |" >> $GITHUB_STEP_SUMMARY
359365 echo "| Coverage | ${{ needs.coverage.result }} |" >> $GITHUB_STEP_SUMMARY
360366 echo "" >> $GITHUB_STEP_SUMMARY
367+ echo "### TFO v2 API Features" >> $GITHUB_STEP_SUMMARY
368+ echo "- v2 endpoints: /v2/traces, /v2/metrics, /v2/logs" >> $GITHUB_STEP_SUMMARY
369+ echo "- Collector identity (aligned with tfoidentityextension)" >> $GITHUB_STEP_SUMMARY
370+ echo "- Auth headers (aligned with tfoauthextension)" >> $GITHUB_STEP_SUMMARY
371+ echo "" >> $GITHUB_STEP_SUMMARY
361372 echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
362373 echo "**Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
363374 echo "**Triggered by:** ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
0 commit comments