Files
CryptoTrading/.gitea/workflows/ci-cd.yaml
bnair123 0e5f48d43f
Some checks failed
CI/CD Pipeline / build-and-push (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
Fix CI/CD workflow: use setup-python instead of container
- Remove container directive that caused Node.js missing error
- Use actions/setup-python@v5 for Python 3.12 setup
- Add sudo for apt-get and make commands on Ubuntu runner
- Add ruff format check step
2025-12-27 18:44:24 +04:00

99 lines
2.7 KiB
YAML

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
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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
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