Add CI workflows for testing and syncing branches, and update Docker image tagging

This commit is contained in:
remsky 2025-01-10 22:03:59 -07:00
parent 926ea8cecf
commit 22c52fdd7e
4 changed files with 121 additions and 8 deletions

51
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: CI
on:
push:
branches: [ "develop", "master" ]
pull_request:
branches: [ "develop", "master" ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install PyTorch CPU
run: |
python -m pip install --upgrade pip
pip install torch --index-url https://download.pytorch.org/whl/cpu
- name: Install dependencies
run: |
pip install ruff pytest-cov
pip install -r requirements.txt
pip install -r requirements-test.txt
- name: Lint with ruff
run: |
ruff check .
- name: Test with pytest
run: |
pytest --asyncio-mode=auto --cov=api --cov-report=term-missing

View file

@ -49,10 +49,10 @@ jobs:
flavor: | flavor: |
suffix=-cpu suffix=-cpu
tags: | tags: |
type=semver,pattern=v{{version}}-cpu type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}-cpu type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}-cpu type=semver,pattern=v{{major}}
type=raw,value=latest-cpu type=raw,value=latest
# Build and push GPU version # Build and push GPU version
- name: Build and push GPU Docker image - name: Build and push GPU Docker image
@ -85,10 +85,10 @@ jobs:
flavor: | flavor: |
suffix=-ui suffix=-ui
tags: | tags: |
type=semver,pattern=v{{version}}-ui type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}-ui type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}-ui type=semver,pattern=v{{major}}
type=raw,value=latest-ui type=raw,value=latest
# Build and push UI version # Build and push UI version
- name: Build and push UI Docker image - name: Build and push UI Docker image

55
.github/workflows/sync-develop.yml vendored Normal file
View file

@ -0,0 +1,55 @@
name: Sync develop with master
on:
push:
branches:
- master
jobs:
sync-develop:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: develop
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Merge master into develop
run: |
git fetch origin master:master
git merge --no-ff origin/master -m "chore: Merge master into develop branch"
- name: Push changes
run: |
if ! git push origin develop; then
echo "Failed to push to develop branch"
exit 1
fi
- name: Handle Failure
if: failure()
uses: actions/github-script@v7
with:
script: |
const issueBody = `Automatic merge from master to develop failed.
Please resolve this manually
Workflow run: ${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: '🔄 Automatic master to develop merge failed',
body: issueBody,
labels: ['merge-failed', 'automation']
});

View file

@ -2,6 +2,13 @@
Notable changes to this project will be documented in this file. Notable changes to this project will be documented in this file.
## [v0.0.5] - 2025-01-10
### Fixed
- Stabilized issues with images tagging and structures from v0.0.4
- Added automatic master to develop branch synchronization
- Improved release tagging and structures
- Initial CI/CD setup
## 2025-01-04 ## 2025-01-04
### Added ### Added
- ONNX Support: - ONNX Support: