Skip to content

Commit dc9f8d7

Browse files
committed
refactor: Split workflows and add Makefile
1 parent d91890e commit dc9f8d7

File tree

6 files changed

+75
-76
lines changed

6 files changed

+75
-76
lines changed

.github/workflows/publish.yaml

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ on:
99
workflow_dispatch:
1010
inputs:
1111
version:
12-
description: 'Version to publish'
12+
description: "Version to publish"
1313
required: false
14-
default: 'latest'
14+
default: "latest"
1515
type: string
1616

1717
jobs:
@@ -25,36 +25,6 @@ jobs:
2525
- name: Check out the repo
2626
uses: actions/checkout@v4
2727

28-
- name: Setup python
29-
uses: actions/setup-python@v5
30-
with:
31-
python-version: '3.10'
32-
cache: 'poetry'
33-
34-
- name: Install dependencies
35-
run: poetry install
36-
37-
- name: Install uv
38-
uses: astral-sh/setup-uv@v5
39-
with:
40-
version: "0.7.17"
41-
42-
- name: Download dependencies
43-
run: |
44-
uv sync
45-
46-
- name: Run ruff
47-
run: |
48-
uvx ruff check --fix --config ruff.toml
49-
50-
- name: Run Unit Tests
51-
run: |
52-
uv run pytest --capture=tee-sys --junitxml=pytest.xml
53-
54-
- name: Run Test Coverage
55-
run: |
56-
uv run pytest --cov=. --cov-report=xml
57-
5828
- name: Extract version
5929
id: extract_version
6030
run: |
@@ -76,41 +46,3 @@ jobs:
7646
tags: |
7747
ghcr.io/sysdiglabs/sysdig-mcp-server:latest
7848
ghcr.io/sysdiglabs/sysdig-mcp-server:v${{ steps.extract_version.outputs.VERSION }}
79-
80-
- name: "Check test reports exists"
81-
if: always()
82-
id: check-test-results-exists
83-
uses: andstor/file-existence-action@v3
84-
with:
85-
files: "pytest.xml, coverage.xml"
86-
87-
- name: Create pack-wise pytest report
88-
run: poetry run python .github/github_workflow_scripts/parse_junit_per_pack.py
89-
if: |
90-
always() &&
91-
steps.check-test-results-exists.outputs.files_exists == 'true' &&
92-
github.event.pull_request.head.repo.fork == false
93-
94-
- name: Upload junit & pack-wise pytest report
95-
uses: PaloAltoNetworks/[email protected]
96-
if: |
97-
always() &&
98-
steps.check-test-results-exists.outputs.files_exists == 'true' &&
99-
github.event.pull_request.head.repo.fork == false
100-
with:
101-
name: pytest
102-
path: |
103-
coverage.xml
104-
if-no-files-found: error
105-
106-
- name: Pytest coverage comment
107-
if: |
108-
always() &&
109-
steps.check-test-results-exists.outputs.files_exists == 'true' &&
110-
steps.check-test-results-exists.outputs.files_exists == 'true' &&
111-
! github.event.pull_request.head.repo.fork
112-
uses: MishaKav/[email protected]
113-
continue-on-error: true # may fail on output > 65k chars
114-
with:
115-
pytest-xml-coverage-path: coverage.xml
116-
junitxml-path: coverage.xml

.github/workflows/test.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
pull_request:
8+
branches:
9+
- "**"
10+
11+
jobs:
12+
test:
13+
name: Test
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read # required for actions/checkout
17+
steps:
18+
- name: Check out the repo
19+
uses: actions/checkout@v4
20+
21+
- name: Setup python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.10"
25+
cache: "pip"
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v5
29+
with:
30+
version: "0.7.17"
31+
32+
- name: Download dependencies
33+
run: make init
34+
35+
- name: Run ruff
36+
run: make lint
37+
38+
- name: Run Unit Tests
39+
run: make test

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ repos:
44
- id: ruff-format
55
name: Ruff Format
66
description: Format code with ruff.
7-
entry: bash -c 'uvx ruff format --config ruff.toml'
7+
entry: make fmt
88
language: system
99
stages: ["commit", "push"]
1010
- id: ruff-check
1111
name: Ruff Check
1212
description: Check code style with ruff.
13-
entry: bash -c 'uvx ruff check --config ruff.toml'
13+
entry: make lint
1414
language: system
1515
stages: ["commit", "push"]

CODEOWNERS

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# These owners will be the default owners for everything in
2-
# the repo. Unless a later match takes precedence,
2+
3+
# the repo. Unless a later match takes precedence
4+
35
# @S3B4SZ17 @alecron and @sysdiglabs/sysdig-training will be requested for
4-
# review when someone opens a pull request.
5-
* @S3B4SZ17 @alecron @sysdiglabs/sysdig-training
6+
7+
# review when someone opens a pull request
8+
9+
* @sysdiglabs/sysdig-training

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.PHONY: help init lint fmt test test-coverage
2+
3+
help:
4+
@echo "Available commands:"
5+
@echo " make init - Install dependencies"
6+
@echo " make lint - Lint and fix code"
7+
@echo " make fmt - Format code"
8+
@echo " make test - Run tests"
9+
@echo " make test-coverage - Run tests and generate coverage report"
10+
11+
init:
12+
uv sync
13+
14+
lint:
15+
uvx ruff check --fix --config ruff.toml
16+
17+
fmt:
18+
uvx ruff format --config ruff.toml
19+
20+
test:
21+
uv run pytest --capture=tee-sys --junitxml=pytest.xml
22+
23+
test-coverage:
24+
uv run pytest --cov=. --cov-report=xml

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def main():
3333
else:
3434
# Run MCP server over streamable HTTP by default
3535
run_http()
36-
36+
3737

3838
if __name__ == "__main__":
3939
main()

0 commit comments

Comments
 (0)