Files
instameex/.gitea/workflows/ci.yml
T
Djeex 3f4737d8e2
CI / build-and-scan (pull_request) Successful in 1m7s
Use the shared cicdeex actions
2026-11-22 12:26:46 +00:00

109 lines
3.5 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Saturday 05:00 UTC: 06:00 in Paris in winter, 07:00 in summer (Gitea runs cron in UTC).
- cron: "0 5 * * 6"
jobs:
build-and-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- name: Get shared actions
uses: actions/checkout@v7
with:
repository: labeex/cicdeex
ref: 1.1.0
token: ${{ secrets.CICDEEX_TOKEN }}
path: .cicdeex
persist-credentials: false
- name: Scan for secrets
uses: ./.cicdeex/secret-scan
- name: Lint Dockerfile with hadolint
uses: ./.cicdeex/hadolint
with:
dockerfile: docker/Dockerfile
- name: Build Docker image
run: |
docker build -f docker/Dockerfile -t instameex:ci . 2>&1 | tee build.log
if grep -q "Building wheel for" build.log; then
echo "::warning::A dependency was built from source — check Python/Alpine compatibility"
fi
- name: Smoke test (syntax + binaries)
run: |
docker run --rm --entrypoint python instameex:ci -m compileall -q /app/main.py /app/src
docker run --rm --entrypoint sh instameex:ci -c "test -x /usr/local/bin/ultrahdr_app && exiftool -ver"
- name: Run unit tests
run: |
docker build -f docker/Dockerfile --target test -t instameex:test .
docker run --rm instameex:test pytest -v --cov=src --cov-report=term-missing --cov-fail-under=75
- name: Lint with ruff
run: docker build -f docker/Dockerfile --target lint -t instameex:lint .
- name: Check deprecation warnings
run: |
docker run --rm --entrypoint python instameex:ci -W error::DeprecationWarning -c "import main" 2>&1 | tee deprecation.log || true
if grep -qi "deprecat" deprecation.log; then
echo "::warning::Deprecation warning detected, check logs"
fi
- name: Scan with Trivy (critical - blocking)
id: trivy_critical
continue-on-error: true
uses: ./.cicdeex/trivy
with:
image: instameex:ci
- name: Handle CRITICAL findings
if: steps.trivy_critical.outcome == 'failure'
uses: ./.cicdeex/remediate
with:
push-token: ${{ secrets.CI_PUSH_TOKEN }}
dockerfile: docker/Dockerfile
from-pattern: "^FROM python:.* AS base$"
- name: Scan with Trivy (high - informative)
uses: ./.cicdeex/trivy
with:
image: instameex:ci
severity: HIGH
exit-code: "0"
- name: Publish tagged image
id: publish
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: ./.cicdeex/publish
with:
image: instameex:ci
paths: '^(VERSION|main\.py|requirements\.txt)$|^(docker|src)/'
push-token: ${{ secrets.CI_PUSH_TOKEN }}
registry-token: ${{ secrets.REGISTRY_TOKEN }}
github-mirror: "true"
github-token: ${{ secrets.GH_TOKEN }}
release-banner: |-
> [!NOTE]
>⚠️ _This is an heavily vibe-coded proof of concept — do not expose it to the internet — use it at your own risk._
- name: Notify failures
if: always()
uses: ./.cicdeex/notify
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
status: ${{ job.status }}