Files
CryptoTrading/.gitea/workflows/ci-cd.yaml
bnair123 38dca66a52
Some checks failed
CI/CD Pipeline / test (push) Failing after 2s
CI/CD Pipeline / build-and-push (push) Has been skipped
Fix CI/CD: use gitea:3000 Docker network hostname
Changed from 'server:3000' to 'gitea:3000' for internal Docker network access.
2025-12-27 19:02:25 +04:00

107 lines
3.1 KiB
YAML

name: CI/CD Pipeline
on:
push:
branches:
- main
tags:
- 'v*'
env:
REGISTRY: gitea.thefetagroup.com
IMAGE_NAME: bnair/cryptobot
# Internal Docker network URL for git operations
GITEA_INTERNAL_URL: http://gitea:3000
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
run: |
git clone --depth 1 ${{ env.GITEA_INTERNAL_URL }}/bnair/CryptoTrading.git .
git fetch origin ${{ github.sha }} --depth 1
git checkout ${{ github.sha }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install system dependencies
run: |
sudo apt-get update
sudo 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 && sudo make && sudo 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 format check
run: ruff format --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
run: |
git clone --depth 1 ${{ env.GITEA_INTERNAL_URL }}/bnair/CryptoTrading.git .
git fetch origin ${{ github.ref_name }} --depth 1
git checkout ${{ github.ref_name }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract version from tag
id: version
run: echo "VERSION=${{ github.ref_name }}" >> $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