Skip to content

fix: remove emojis, fix HTMX forms, add SHAP, fix DocQA filtering #1

fix: remove emojis, fix HTMX forms, add SHAP, fix DocQA filtering

fix: remove emojis, fix HTMX forms, add SHAP, fix DocQA filtering #1

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov pytest-asyncio black ruff mypy
- name: Lint with Ruff
run: |
ruff check app/ tests/
- name: Format check with Black
run: |
black --check app/ tests/
- name: Type check with Mypy
run: |
mypy app/ --ignore-missing-imports
continue-on-error: true # Type checking é informativo por enquanto
- name: Test with pytest
run: |
pytest tests/ -v --cov=app --cov-report=xml --cov-report=term
env:
ENV: test
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
build:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Set up Podman
run: |
sudo apt-get update
sudo apt-get -y install podman
- name: Build container
run: |
podman build -t kaio-portfolio:${{ github.sha }} -f Containerfile .
podman tag kaio-portfolio:${{ github.sha }} kaio-portfolio:latest
- name: Test container health
run: |
podman run -d --name test-container -p 8000:8000 \
-e ENV=production \
-e GROQ_API_KEY=test \
kaio-portfolio:latest
sleep 10
curl --fail http://localhost:8000/api/health || exit 1
podman stop test-container
podman rm test-container
- name: Save container image
if: success()
run: |
podman save -o kaio-portfolio.tar kaio-portfolio:latest
- name: Upload artifact
if: success()
uses: actions/upload-artifact@v4
with:
name: kaio-portfolio-image
path: kaio-portfolio.tar
retention-days: 30
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
scan-ref: '.'
format: 'sarif'
output: 'trivy-results.sarif'
- name: Upload Trivy results to GitHub Security
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: 'trivy-results.sarif'