Skip to content

Commit e6019c9

Browse files
Merge pull request #53 from floriangrousset/feat/devops-foundation
feat: Phase 1 - DevOps Foundation Infrastructure
2 parents 2313ff7 + b380bc8 commit e6019c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+4428
-3313
lines changed

.dockerignore

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Git files
2+
.git
3+
.gitignore
4+
.gitattributes
5+
6+
# Python cache
7+
__pycache__/
8+
*.py[cod]
9+
*$py.class
10+
*.so
11+
.Python
12+
13+
# Virtual environments
14+
.venv/
15+
venv/
16+
ENV/
17+
env/
18+
19+
# Testing
20+
.pytest_cache/
21+
.coverage
22+
.coverage.*
23+
htmlcov/
24+
.tox/
25+
.mypy_cache/
26+
.ruff_cache/
27+
coverage.xml
28+
*.cover
29+
30+
# Build artifacts
31+
build/
32+
dist/
33+
*.egg-info/
34+
.eggs/
35+
36+
# IDE
37+
.vscode/
38+
.idea/
39+
*.swp
40+
*.swo
41+
*~
42+
.DS_Store
43+
44+
# Documentation
45+
docs/
46+
*.md
47+
!README.md
48+
49+
# CI/CD
50+
.github/
51+
.gitlab-ci.yml
52+
.travis.yml
53+
54+
# Tests
55+
tests/
56+
test_*.py
57+
*_test.py
58+
59+
# Development tools
60+
Makefile
61+
.editorconfig
62+
.pre-commit-config.yaml
63+
64+
# Local configuration
65+
.env
66+
.env.local
67+
*.local
68+
69+
# Logs
70+
*.log
71+
72+
# Benchmarks
73+
.benchmarks/
74+
75+
# Archives
76+
docs/archive/
77+
78+
# Scripts (unless needed)
79+
scripts/
80+
81+
# Temporary files
82+
tmp/
83+
temp/
84+
*.tmp

.editorconfig

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# Top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
13+
# Python files
14+
[*.py]
15+
indent_style = space
16+
indent_size = 4
17+
max_line_length = 100
18+
19+
# YAML files
20+
[*.{yml,yaml}]
21+
indent_style = space
22+
indent_size = 2
23+
24+
# JSON files
25+
[*.json]
26+
indent_style = space
27+
indent_size = 2
28+
29+
# TOML files
30+
[*.toml]
31+
indent_style = space
32+
indent_size = 4
33+
34+
# Markdown files
35+
[*.md]
36+
trim_trailing_whitespace = false
37+
max_line_length = off
38+
39+
# Makefile
40+
[Makefile]
41+
indent_style = tab
42+
43+
# Shell scripts
44+
[*.sh]
45+
indent_style = space
46+
indent_size = 2
47+
48+
# Dockerfile
49+
[Dockerfile*]
50+
indent_style = space
51+
indent_size = 2

.github/workflows/ci.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
test:
11+
name: Test Python ${{ matrix.python-version }}
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.10", "3.11", "3.12"]
16+
fail-fast: false
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v3
29+
30+
- name: Cache dependencies
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.cache/uv
34+
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
35+
restore-keys: |
36+
${{ runner.os }}-uv-${{ matrix.python-version }}-
37+
${{ runner.os }}-uv-
38+
39+
- name: Install dependencies
40+
run: |
41+
uv pip install --system -r requirements.txt
42+
uv pip install --system -e ".[dev]"
43+
44+
- name: Run tests with coverage
45+
run: |
46+
pytest --cov=src/opnsense_mcp --cov-report=xml --cov-report=term-missing --tb=short
47+
48+
- name: Upload coverage to Codecov
49+
uses: codecov/codecov-action@v4
50+
if: matrix.python-version == '3.10'
51+
with:
52+
file: ./coverage.xml
53+
flags: unittests
54+
name: codecov-umbrella
55+
fail_ci_if_error: false
56+
57+
lint:
58+
name: Lint and Format Check
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@v4
64+
65+
- name: Set up Python 3.10
66+
uses: actions/setup-python@v5
67+
with:
68+
python-version: "3.10"
69+
70+
- name: Install uv
71+
uses: astral-sh/setup-uv@v3
72+
73+
- name: Install dependencies
74+
run: |
75+
uv pip install --system black ruff mypy
76+
77+
- name: Check code formatting with black
78+
run: black --check src/ tests/
79+
80+
- name: Lint with ruff
81+
run: ruff check src/ tests/
82+
83+
- name: Type check with mypy
84+
run: mypy src/
85+
continue-on-error: true
86+
87+
security:
88+
name: Security Check
89+
runs-on: ubuntu-latest
90+
91+
steps:
92+
- name: Checkout code
93+
uses: actions/checkout@v4
94+
95+
- name: Set up Python 3.10
96+
uses: actions/setup-python@v5
97+
with:
98+
python-version: "3.10"
99+
100+
- name: Install uv
101+
uses: astral-sh/setup-uv@v3
102+
103+
- name: Install dependencies
104+
run: |
105+
uv pip install --system -r requirements.txt
106+
uv pip install --system pip-audit
107+
108+
- name: Run pip-audit
109+
run: pip-audit --require-hashes --disable-pip
110+
continue-on-error: true
111+
112+
docker:
113+
name: Docker Build Test
114+
runs-on: ubuntu-latest
115+
116+
steps:
117+
- name: Checkout code
118+
uses: actions/checkout@v4
119+
120+
- name: Set up Docker Buildx
121+
uses: docker/setup-buildx-action@v3
122+
123+
- name: Build Docker image
124+
uses: docker/build-push-action@v5
125+
with:
126+
context: .
127+
push: false
128+
tags: opnsense-mcp-server:test
129+
cache-from: type=gha
130+
cache-to: type=gha,mode=max

.github/workflows/release.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build and Release
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Python 3.10
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.10"
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v3
29+
30+
- name: Install build dependencies
31+
run: |
32+
uv pip install --system build twine
33+
34+
- name: Build package
35+
run: python -m build
36+
37+
- name: Check package
38+
run: twine check dist/*
39+
40+
- name: Extract version from tag
41+
id: get_version
42+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
43+
44+
- name: Extract changelog for this version
45+
id: changelog
46+
run: |
47+
VERSION=${{ steps.get_version.outputs.VERSION }}
48+
if [ -f CHANGELOG.md ]; then
49+
# Extract changelog section for this version
50+
awk "/^## \[$VERSION\]/,/^## \[/{if(/^## \[/ && !/^## \[$VERSION\]/)exit;print}" CHANGELOG.md > release_notes.md
51+
else
52+
echo "Release $VERSION" > release_notes.md
53+
fi
54+
55+
- name: Create GitHub Release
56+
uses: softprops/action-gh-release@v1
57+
with:
58+
body_path: release_notes.md
59+
files: dist/*
60+
draft: false
61+
prerelease: ${{ contains(steps.get_version.outputs.VERSION, '-') }}
62+
63+
- name: Publish to PyPI
64+
if: ${{ !contains(steps.get_version.outputs.VERSION, '-') }}
65+
env:
66+
TWINE_USERNAME: __token__
67+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
68+
run: |
69+
if [ -n "$TWINE_PASSWORD" ]; then
70+
twine upload dist/*
71+
else
72+
echo "PyPI token not configured, skipping upload"
73+
fi
74+
continue-on-error: true

0 commit comments

Comments
 (0)