Files
shopping-list-api/.gitea/workflows/ci.yml
Lennie S. 3c071c209d
Some checks failed
CI / test (push) Successful in 40s
CI / docker-push (push) Failing after 1m36s
fix: rewrite CI workflow for proper Gitea Actions syntax
2026-04-12 03:07:30 +00:00

70 lines
1.6 KiB
YAML

name: CI
on:
push:
branches:
- main
- master
pull_request:
env:
REGISTRY: git.danhenry.dev
IMAGE_NAME: git.danhenry.dev/thelab/shopping-list-api
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Sync dependencies
run: uv sync --frozen --dev
- name: Run tests
run: uv run pytest
docker-push:
runs-on: ubuntu-latest
needs: test
if: gitea.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Gitea container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
- name: Extract commit SHA
run: echo "SHA=${GITEA_SHA:0:7}" >> $GITHUB_ENV
- name: Build and push multi-arch image
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ env.IMAGE_NAME }}:${{ env.SHA }}
${{ env.IMAGE_NAME }}:latest
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest
cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:latest,mode=max