Files
bouncer/.gitea/workflows/ci.yml
user f14d067779
Some checks failed
CI / secrets (push) Failing after 0s
CI / lint (push) Successful in 13s
CI / test (push) Successful in 25s
CI / build (push) Has been skipped
fix: use alpine/git container for checkout on host jobs
The linux runner has podman but no git. Clone repos via
alpine/git container for secrets and build host jobs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 08:15:42 +01:00

84 lines
2.6 KiB
YAML

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
lint:
runs-on: linux
container:
image: python:3.12-alpine
steps:
- name: Checkout
run: |
apk add --no-cache -q git
git clone --depth 1 --branch "${GITHUB_REF_NAME}" \
"https://oauth2:${{ github.token }}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" .
- name: Install ruff
run: pip install --no-cache-dir -q ruff
- name: Lint
run: ruff check src/ tests/
test:
runs-on: linux
needs: [lint]
container:
image: python:3.12-alpine
steps:
- name: Checkout
run: |
apk add --no-cache -q git
git clone --depth 1 --branch "${GITHUB_REF_NAME}" \
"https://oauth2:${{ github.token }}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" .
- name: Install deps
run: |
pip install --no-cache-dir -q -r requirements.txt
pip install --no-cache-dir -q pytest pytest-asyncio
- name: Test
run: PYTHONPATH=src pytest tests/ -v
secrets:
runs-on: linux
steps:
- name: Checkout
run: |
podman run --rm \
-v "$PWD:/repo" \
-w /repo \
alpine/git:latest \
clone --branch "${GITHUB_REF_NAME}" "https://oauth2:${{ github.token }}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" .
- name: Scan for secrets
run: |
podman run --rm \
-v "$PWD:/scan:ro" \
ghcr.io/gitleaks/gitleaks:latest \
detect --source /scan -v
build:
runs-on: linux
needs: [test, secrets]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout
run: |
podman run --rm \
-v "$PWD:/repo" \
-w /repo \
alpine/git:latest \
clone --depth 1 --branch "${GITHUB_REF_NAME}" "https://oauth2:${{ github.token }}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" .
- name: Login to Harbor
run: echo "$HARBOR_PASS" | podman login -u "$HARBOR_USER" --password-stdin harbor.mymx.me
env:
HARBOR_USER: ${{ secrets.HARBOR_USER }}
HARBOR_PASS: ${{ secrets.HARBOR_PASS }}
- name: Build and push
run: |
TAG="harbor.mymx.me/library/bouncer:${GITHUB_SHA::8}"
LATEST="harbor.mymx.me/library/bouncer:latest"
podman build -t "$TAG" -t "$LATEST" -f Containerfile .
podman push "$TAG"
podman push "$LATEST"