Add CI/CD workflows for automated builds and deployments on Gitea
Some checks failed
CI / lint (push) Failing after 20s
CI / test (push) Failing after 2s

- Introduces CI workflows for linting and testing.
- Adds a deployment workflow triggered by successful CI runs on master.
- Configures DockerHub and Gitea registry authentication.
- Replaces GitLab CI with GitHub Actions workflows.
- Removes the GitLab CI configuration.
- Uses `uv` for running Python tools.
- Implements Codecov integration for coverage reporting.
- Sets up Docker Buildx for multi-platform builds.
This commit is contained in:
Roger Gonzalez 2025-05-17 13:51:09 -03:00
parent f80b805a71
commit 7b728d90e0
Signed by: rogs
GPG Key ID: C7ECE9C6C36EC2E6
3 changed files with 63 additions and 25 deletions

32
.gitea/workflows/ci.yml Normal file
View File

@ -0,0 +1,32 @@
name: CI
on:
push:
branches:
- '**'
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
container:
image: ghcr.io/astral-sh/uv:0.6-python3.13-bookworm
steps:
- uses: actions/checkout@v3
- name: Run Ruff & Mypy
run: |
uv run ruff check
uv run ruff format --check
uv run mypy .
test:
runs-on: ubuntu-latest
container:
image: ghcr.io/astral-sh/uv:0.6-python3.13-bookworm
steps:
- uses: actions/checkout@v3
- name: Run Pytest
run: |
uv run pytest -v --cov=. --cov-report=xml
- name: Upload to Codecov
run: bash <(curl -s https://codecov.io/bash)

View File

@ -0,0 +1,31 @@
name: Deploy to DockerHub & Gitea
on:
workflow_run:
workflows: ["CI"]
types:
- completed
jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Log in to DockerHub
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
- name: Log in to Gitea Registry
run: echo "${{ vars.REPOSITORY_TOKEN }}" | docker login git.rogs.me -u rogs --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push image
run: |
docker buildx build --push \
--tag rogsme/cleanmedia:latest \
--tag git.rogs.me/rogs/cleanmedia:latest \
.

View File

@ -16,31 +16,6 @@ test:
stage: test
script:
- uv run pytest -v --cov=. --cov-report=xml
after_script:
- bash <(curl -s https://codecov.io/bash)
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
deploy_to_dockerhub:
stage: deploy
needs:
- test
only:
refs:
- master
except:
- tags
image: docker:latest
services:
- docker:dind
before_script:
- docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
- docker buildx create --use
script:
- docker buildx build --push --tag rogsme/cleanmedia:latest .
deploy_to_gitlab:
stage: deploy