Skip to content

update ci

update ci #10

Workflow file for this run

name: CI
on:
push:
tags:
- "v*.*.*"
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements.dev.txt
- name: Lint with flake8
run: |
flake8 app tests
- name: Test with pytest
run: |
pytest
docker:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Extract version
id: extract_version
run: |
VERSION=$(python -c 'from app import __version__; print(__version__)')
echo "::set-output name=VERSION::$VERSION"
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
VERSION=${{ steps.extract_version.outputs.VERSION }}
tags: |
mohrezfadaei/py-btcup:latest
mohrezfadaei/py-btcup:${{ github.ref_name }}
ghcr.io/mohrezfadaei/py-btcup:latest
ghcr.io/mohrezfadaei/py-btcup:${{ github.ref_name }}