Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 97a47ed9c8 | |||
| 3f0df932e0 | |||
| 02f1ebdecf | |||
| 7eec0c6902 | |||
| b7eb8aacfc | |||
| b8f1ae00b7 | |||
| 959ff490f5 |
@@ -49,43 +49,7 @@ jobs:
|
||||
- name: Unit Test
|
||||
run: |
|
||||
uv run coverage run -m pytest -v --junitxml=testresults.xml
|
||||
uv run coverage xml
|
||||
sed -i 's@${{ gitea.workspace }}@/github/workspace@g' coverage.xml
|
||||
uv run coverage report
|
||||
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
|
||||
# - name: SonarQube Scan
|
||||
# uses: SonarSource/sonarqube-scan-action@v5.2.0
|
||||
# env:
|
||||
# SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST_URL }}
|
||||
# SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
||||
|
||||
# - name: Set up environment for Snyk
|
||||
# run: |
|
||||
# uv pip freeze > requirements.txt
|
||||
# mv pyproject.toml pyproject.toml.bak
|
||||
# mv uv.lock uv.lock.bak
|
||||
|
||||
# - name: Snyk SAST Scan
|
||||
# uses: snyk/actions/python@master
|
||||
# env:
|
||||
# SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
||||
# with:
|
||||
# # command: snyk
|
||||
# args: snyk code test #--all-projects --exclude=.archive
|
||||
|
||||
# - name: Snyk Vulnerability Scan
|
||||
# uses: snyk/actions/python@master
|
||||
# continue-on-error: true # Sometimes vulns aren't immediately fixable
|
||||
# env:
|
||||
# SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
||||
# with:
|
||||
# command: snyk
|
||||
# args: test --all-projects
|
||||
|
||||
# - name: Reverse set up environment for Snyk
|
||||
# run: |
|
||||
# rm -f requirements.txt
|
||||
# mv pyproject.toml.bak pyproject.toml
|
||||
# mv uv.lock.bak uv.lock
|
||||
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
# with:
|
||||
# python-version: "3.13"
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "uv.lock"
|
||||
|
||||
61
.gitea/workflows/sonar.yml
Normal file
61
.gitea/workflows/sonar.yml
Normal file
@@ -0,0 +1,61 @@
|
||||
name: Sonar
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
sonar:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v6.0.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run Hadolint
|
||||
uses: hadolint/hadolint-action@v3.3.0
|
||||
with:
|
||||
dockerfile: Dockerfile
|
||||
output-file: hadolint.out
|
||||
format: sonarqube
|
||||
no-fail: true
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.14"
|
||||
|
||||
- name: uv cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: /tmp/.uv-cache
|
||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||
restore-keys: |
|
||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||
uv-${{ runner.os }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync
|
||||
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
uv run pylint --exit-zero --recursive=yes --output-format=parseable --output=lintreport.txt app/ tests/
|
||||
cat lintreport.txt
|
||||
|
||||
- name: Unit Test
|
||||
run: |
|
||||
uv run coverage run -m pytest -v --junitxml=testresults.xml
|
||||
uv run coverage report
|
||||
uv run coverage xml -q -o coverage.xml
|
||||
sed -i 's@${{ gitea.workspace }}@/github/workspace@g' coverage.xml
|
||||
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
|
||||
- name: SonarQube Scan
|
||||
uses: SonarSource/sonarqube-scan-action@v7.1.0
|
||||
env:
|
||||
SONAR_HOST_URL: ${{ vars.SONAR_URL }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
@@ -3,12 +3,14 @@ LABEL maintainer="Luke Tainton <luke@tainton.uk>"
|
||||
LABEL org.opencontainers.image.source="https://github.com/luketainton/pypilot"
|
||||
USER root
|
||||
|
||||
ENV PYTHONPATH="/run:/usr/local/lib/python3.13/lib-dynload:/usr/local/lib/python3.13/site-packages:/usr/local/lib/python3.13"
|
||||
RUN useradd -r -s /sbin/nologin -M user
|
||||
|
||||
ENV PYTHONPATH="/run:/usr/local/lib/python3.14/lib-dynload:/usr/local/lib/python3.14/site-packages:/usr/local/lib/python3.14"
|
||||
WORKDIR /run
|
||||
|
||||
RUN mkdir -p /.local && \
|
||||
chmod -R 777 /.local && \
|
||||
pip install -U pip uv==0.5.14
|
||||
pip install --no-cache-dir -U pip uv==0.5.14
|
||||
|
||||
COPY pyproject.toml /run/pyproject.toml
|
||||
COPY uv.lock /run/uv.lock
|
||||
@@ -23,3 +25,6 @@ ARG version="dev"
|
||||
ENV APP_VERSION=$version
|
||||
|
||||
COPY app /run/app
|
||||
|
||||
RUN chown -R user:user /run
|
||||
USER user
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# iPilot [](https://github.com/luketainton/pypilot/actions/workflows/ci.yml) [](https://sonarcloud.io/summary/new_code?id=luketainton_pypilot)
|
||||
# iPilot
|
||||
|
||||
## Description
|
||||
IP Information Lookup Tool
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
sonar.projectKey=pypilot
|
||||
sonar.projectName=pypilot
|
||||
sonar.python.version=3.13
|
||||
sonar.python.version=3.14
|
||||
sonar.python.coverage.reportPaths=coverage.xml
|
||||
sonar.python.pylint.reportPaths=lintreport.txt
|
||||
sonar.python.xunit.reportPath=testresults.xml
|
||||
sonar.sources=Dockerfile,app
|
||||
sonar.tests=tests
|
||||
sonar.exclusions=,.archive/**,.gitea/**,.gitignore,renovate.json
|
||||
sonar.coverage.exclusions=app/_version.py,app/args.py,app/main.py
|
||||
sonar.coverage.exclusions=app/args.py,app/main.py
|
||||
|
||||
12
uv.lock
generated
12
uv.lock
generated
@@ -379,11 +379,11 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "platformdirs"
|
||||
version = "4.9.4"
|
||||
version = "4.9.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/19/56/8d4c30c8a1d07013911a8fdbd8f89440ef9f08d07a1b50ab8ca8be5a20f9/platformdirs-4.9.4.tar.gz", hash = "sha256:1ec356301b7dc906d83f371c8f487070e99d3ccf9e501686456394622a01a934", size = 28737, upload-time = "2026-03-05T18:34:13.271Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9f/4a/0883b8e3802965322523f0b200ecf33d31f10991d0401162f4b23c698b42/platformdirs-4.9.6.tar.gz", hash = "sha256:3bfa75b0ad0db84096ae777218481852c0ebc6c727b3168c1b9e0118e458cf0a", size = 29400, upload-time = "2026-04-09T00:04:10.812Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/63/d7/97f7e3a6abb67d8080dd406fd4df842c2be0efaf712d1c899c32a075027c/platformdirs-4.9.4-py3-none-any.whl", hash = "sha256:68a9a4619a666ea6439f2ff250c12a853cd1cbd5158d258bd824a7df6be2f868", size = 21216, upload-time = "2026-03-05T18:34:12.172Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/75/a6/a0a304dc33b49145b21f4808d763822111e67d1c3a32b524a1baf947b6e1/platformdirs-4.9.6-py3-none-any.whl", hash = "sha256:e61adb1d5e5cb3441b4b7710bea7e4c12250ca49439228cc1021c00dcfac0917", size = 21348, upload-time = "2026-04-09T00:04:09.463Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -433,7 +433,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "pytest"
|
||||
version = "9.0.2"
|
||||
version = "9.0.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||
@@ -442,9 +442,9 @@ dependencies = [
|
||||
{ name = "pluggy" },
|
||||
{ name = "pygments" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d1/db/7ef3487e0fb0049ddb5ce41d3a49c235bf9ad299b6a25d5780a89f19230f/pytest-9.0.2.tar.gz", hash = "sha256:75186651a92bd89611d1d9fc20f0b4345fd827c41ccd5c299a868a05d70edf11", size = 1568901, upload-time = "2025-12-06T21:30:51.014Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/7d/0d/549bd94f1a0a402dc8cf64563a117c0f3765662e2e668477624baeec44d5/pytest-9.0.3.tar.gz", hash = "sha256:b86ada508af81d19edeb213c681b1d48246c1a91d304c6c81a427674c17eb91c", size = 1572165, upload-time = "2026-04-07T17:16:18.027Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/3b/ab/b3226f0bd7cdcf710fbede2b3548584366da3b19b5021e74f5bde2a8fa3f/pytest-9.0.2-py3-none-any.whl", hash = "sha256:711ffd45bf766d5264d487b917733b453d917afd2b0ad65223959f59089f875b", size = 374801, upload-time = "2025-12-06T21:30:49.154Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d4/24/a372aaf5c9b7208e7112038812994107bc65a84cd00e0354a88c2c77a617/pytest-9.0.3-py3-none-any.whl", hash = "sha256:2c5efc453d45394fdd706ade797c0a81091eccd1d6e4bccfcd476e2b8e0ab5d9", size = 375249, upload-time = "2026-04-07T17:16:16.13Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
Reference in New Issue
Block a user