Add Gitea Actions CI/CD pipeline for automated testing and container builds
Some checks failed
CI/CD Pipeline / test (push) Failing after 11s
CI/CD Pipeline / build-and-push (push) Has been skipped

- Add .gitea/workflows/ci-cd.yaml with test and build-push jobs
- Tests run on every push to main, builds trigger on v* tags
- Builds both engine and UI Docker images to Gitea container registry
- Update Dockerfile to Python 3.12 (matches pyproject.toml requirement)
- Requires REGISTRY_USERNAME and REGISTRY_PASSWORD secrets in Gitea
This commit is contained in:
bnair123
2025-12-27 18:33:51 +04:00
parent e17c3bf508
commit f46846fcee
2 changed files with 93 additions and 1 deletions

View File

@@ -0,0 +1,92 @@
name: CI/CD Pipeline
on:
push:
branches:
- main
tags:
- 'v*'
env:
REGISTRY: gitea.thefetagroup.com
IMAGE_NAME: bnair/cryptobot
jobs:
test:
runs-on: ubuntu-latest
container:
image: python:3.12-slim
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install system dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends build-essential wget
wget -q http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib && ./configure --prefix=/usr && make && make install
cd .. && rm -rf ta-lib ta-lib-0.4.0-src.tar.gz
- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install -e ".[dev]"
- name: Run linting
run: ruff check .
- name: Run type checking
run: mypy src/
- name: Run tests
run: pytest --cov=tradefinder --cov-report=term-missing
build-and-push:
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Login to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push engine image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: engine
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push UI image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: ui
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ui:${{ steps.version.outputs.VERSION }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ui:latest
cache-from: type=gha
cache-to: type=gha,mode=max