Files
vuln-mcp/.gitea/workflows/ci.yml
T
omar 5d1e5d2cac
CI / Python 3.13 (push) Successful in 28s
CI / Python 3.12 (push) Successful in 52s
CI / Build and smoke-test image (push) Successful in 14s
Ship an English-only offline ASVS catalog with searchable MCP guides
2026-11-28 17:19:58 +03:00

78 lines
2.8 KiB
YAML

name: CI
on:
push:
pull_request:
permissions:
contents: read
jobs:
test:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
python-version: ['3.12', '3.13']
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- name: Check project text and filenames are ASCII
run: python3 .gitea/scripts/check_ascii.py
- uses: https://github.com/astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
with:
version: '0.11.16'
python-version: ${{ matrix.python-version }}
github-token: ''
enable-cache: false
- name: Install locked dependencies
run: |
uv python install
uv sync --locked --group dev
- name: Test with branch coverage
run: uv run --locked pytest --cov --cov-report=term-missing --cov-report=xml
# This Gitea runner exposes the legacy artifact API.
- name: Upload coverage XML
if: ${{ !cancelled() }}
uses: https://github.com/actions/upload-artifact@c6a366c94c3e0affe28c06c8df20a878f24da3cf # v3.2.2
with:
name: coverage-python-${{ matrix.python-version }}
path: coverage.xml
if-no-files-found: error
docker:
name: Build and smoke-test image
needs: test
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- name: Build runtime image
run: docker build --iidfile "$RUNNER_TEMP/vuln-mcp.iid" .
- name: Exercise stdio with no network
run: python3 .gitea/scripts/smoke_image.py "$(cat "$RUNNER_TEMP/vuln-mcp.iid")"
- name: Publish tested image to Gitea Container Registry
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'omar/vuln-mcp' }}
env:
IMAGE: git.eeee.moe/omar/vuln-mcp
REGISTRY_TOKEN: ${{ secrets.VULN_MCP_REGISTRY_TOKEN }}
REVISION: ${{ github.sha }}
run: |
set -eu
export DOCKER_CONFIG="$(mktemp -d)"
trap 'rm -rf "$DOCKER_CONFIG"' EXIT
printf '%s' "$REGISTRY_TOKEN" | docker login git.eeee.moe --username omar --password-stdin
unset REGISTRY_TOKEN
iid=$(cat "$RUNNER_TEMP/vuln-mcp.iid")
docker tag "$iid" "$IMAGE:$REVISION"
docker push "$IMAGE:$REVISION"
if [ "$(git ls-remote --exit-code origin refs/heads/main | cut -f1)" = "$REVISION" ]; then
docker tag "$iid" "$IMAGE:latest"
docker push "$IMAGE:latest"
fi