Skip to content

Commit 0fb52f0

Browse files
authored
Merge pull request #1 from flatcar/john15321/implement-uv-template
Refactor code structure for improved readability and maintainability
2 parents 2e4d308 + 3c18dfd commit 0fb52f0

19 files changed

Lines changed: 1197 additions & 11 deletions

‎.coveragerc‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[report]
2+
exclude_lines =
3+
pragma: no cover
4+
@abstract

‎.github/workflows/install.yml‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: 🔨 Install dependencies
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
install:
9+
name: 🔨 Install Python ${{ matrix.python-version }} on ${{ matrix.os }}
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, windows-latest, macos-latest]
14+
python-version: ["3.12", "3.13", "3.14"]
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v2
27+
28+
- name: Build package
29+
run: |
30+
uv build
31+
32+
- name: Create isolated venv (Unix)
33+
if: runner.os != 'Windows'
34+
run: |
35+
uv venv .wheel-test-env --python "${{ matrix.python-version }}"
36+
37+
- name: Create isolated venv (Windows)
38+
if: runner.os == 'Windows'
39+
run: |
40+
uv venv .wheel-test-env --python "${{ matrix.python-version }}"
41+
42+
- name: Install wheel in isolated venv (Unix)
43+
if: runner.os != 'Windows'
44+
run: |
45+
uv pip install --python ./.wheel-test-env/bin/python dist/security_triage-*.whl
46+
47+
- name: Install wheel in isolated venv (Windows)
48+
if: runner.os == 'Windows'
49+
run: |
50+
$wheel = Get-ChildItem dist/*.whl | Select-Object -First 1
51+
if (-not $wheel) {
52+
throw "No wheel file found in dist/"
53+
}
54+
uv pip install --python ./.wheel-test-env/Scripts/python.exe "$($wheel.FullName)"
55+
56+
- name: Verify installed package (Unix)
57+
if: runner.os != 'Windows'
58+
run: |
59+
./.wheel-test-env/bin/python -c "from security_triage.cli import main; print('Package imports successfully')"
60+
./.wheel-test-env/bin/security-triage --version
61+
62+
- name: Verify installed package (Windows)
63+
if: runner.os == 'Windows'
64+
run: |
65+
./.wheel-test-env/Scripts/python.exe -c "from security_triage.cli import main; print('Package imports successfully')"
66+
$entrypoint = Get-ChildItem ./.wheel-test-env/Scripts/security-triage* | Select-Object -First 1
67+
if (-not $entrypoint) {
68+
throw "Could not find installed security-triage entrypoint"
69+
}
70+
& $entrypoint.FullName --version

‎.github/workflows/lint.yml‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: 🔍 Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
name: 🔍 Code Quality
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: "3.12"
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v2
25+
26+
- name: Install dependencies
27+
run: |
28+
uv sync --dev
29+
30+
- name: Run ruff check
31+
run: |
32+
uv run ruff check src/ tests/
33+
34+
- name: Run ruff format check
35+
run: |
36+
uv run ruff format --check src/ tests/
37+
38+
- name: Run type checking
39+
run: |
40+
uv run mypy src/ tests/

‎.github/workflows/publish.yml‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Uncomment to enable publishing to PyPI on release
2+
# name: 📦 Build and Publish
3+
4+
# on:
5+
# release:
6+
# types: [published]
7+
# push:
8+
# tags:
9+
# - "v*"
10+
11+
# # jobs:
12+
# build:
13+
# name: 📦 Build distribution
14+
# runs-on: ubuntu-latest
15+
# steps:
16+
# - name: Checkout code
17+
# uses: actions/checkout@v4
18+
19+
# - name: Set up Python
20+
# uses: actions/setup-python@v4
21+
# with:
22+
# python-version: "3.12"
23+
24+
# - name: Install uv
25+
# uses: astral-sh/setup-uv@v4
26+
# with:
27+
# version: "0.5.4"
28+
29+
# - name: Build package
30+
# run: |
31+
# uv build
32+
33+
# - name: Upload build artifacts
34+
# uses: actions/upload-artifact@v3
35+
# with:
36+
# name: dist
37+
# path: dist/
38+
39+
# publish:
40+
# name: 🚀 Publish to PyPI
41+
# runs-on: ubuntu-latest
42+
# needs: [build]
43+
# if: github.event_name == 'release' && github.event.action == 'published'
44+
# environment:
45+
# name: pypi
46+
# url: https://pypi.org/p/security-triage
47+
# permissions:
48+
# id-token: write
49+
50+
# steps:
51+
# - name: Download build artifacts
52+
# uses: actions/download-artifact@v3
53+
# with:
54+
# name: dist
55+
# path: dist/
56+
57+
# - name: Publish to PyPI
58+
# uses: pypa/gh-action-pypi-publish@release/v1

‎.github/workflows/release.yml‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 🚀 Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
9+
permissions:
10+
contents: write
11+
id-token: write
12+
pull-requests: read
13+
issues: read
14+
15+
jobs:
16+
release:
17+
name: 📦 Release Package
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: 🐍 Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.12"
29+
30+
- name: ⚡ Install UV
31+
uses: astral-sh/setup-uv@v4
32+
with:
33+
version: "latest"
34+
35+
- name: 🔧 Set up Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: "20"
39+
40+
- name: 📦 Install semantic-release
41+
run: |
42+
npm install -g semantic-release
43+
npm install -g @semantic-release/changelog
44+
npm install -g @semantic-release/exec
45+
npm install -g @semantic-release/git
46+
npm install -g @semantic-release/github
47+
48+
- name: 🚀 Run semantic-release
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
run: npx semantic-release

‎.github/workflows/tests.yml‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: 🧪 Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: 🧪 Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
python-version: ["3.12", "3.13", "3.14"]
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@v4
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v2
29+
30+
- name: Install dependencies
31+
run: |
32+
uv sync --all-extras --dev
33+
34+
- name: Run tests
35+
run: |
36+
uv run pytest

‎AUTHORS.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Authors
2+
3+
## Creator
4+
5+
- Daniel Szot <danielszot@microsoft.com> ([@danielszot](https://github.com/danielszot))
6+
7+
## Contributors
8+
9+
<!-- Add contributors here as the project grows -->
10+
11+
Thank you to all contributors who have helped make this project better!

‎CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

‎CODEOWNERS‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CODEOWNERS file for security-triage
2+
# This file defines who is responsible for code review
3+
# See: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
4+
5+
* @flatcar/flatcar-maintainers @danielszot

‎CODE_OF_CONDUCT.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Code of Conduct
2+
3+
The Flatcar project follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).
4+
5+
For details on how we uphold community standards across all Flatcar repositories, please see the [main Flatcar Code of Conduct](https://github.com/flatcar/Flatcar/blob/main/CODE_OF_CONDUCT.md).
6+
7+
## Reporting
8+
9+
If you experience or witness unacceptable behavior, please report it following the process outlined in the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).

0 commit comments

Comments
 (0)