Skip to content

Commit 22c52fd

Browse files
committed
Add CI workflows for testing and syncing branches, and update Docker image tagging
1 parent 926ea8c commit 22c52fd

File tree

4 files changed

+121
-8
lines changed

4 files changed

+121
-8
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "develop", "master" ]
6+
pull_request:
7+
branches: [ "develop", "master" ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.9", "3.10", "3.11"]
15+
fail-fast: false
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Set up pip cache
26+
uses: actions/cache@v3
27+
with:
28+
path: ~/.cache/pip
29+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
30+
restore-keys: |
31+
${{ runner.os }}-pip-
32+
33+
- name: Install PyTorch CPU
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install torch --index-url https://download.pytorch.org/whl/cpu
37+
38+
- name: Install dependencies
39+
run: |
40+
pip install ruff pytest-cov
41+
pip install -r requirements.txt
42+
pip install -r requirements-test.txt
43+
44+
- name: Lint with ruff
45+
run: |
46+
ruff check .
47+
48+
49+
- name: Test with pytest
50+
run: |
51+
pytest --asyncio-mode=auto --cov=api --cov-report=term-missing

.github/workflows/docker-publish.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ jobs:
4949
flavor: |
5050
suffix=-cpu
5151
tags: |
52-
type=semver,pattern=v{{version}}-cpu
53-
type=semver,pattern=v{{major}}.{{minor}}-cpu
54-
type=semver,pattern=v{{major}}-cpu
55-
type=raw,value=latest-cpu
52+
type=semver,pattern=v{{version}}
53+
type=semver,pattern=v{{major}}.{{minor}}
54+
type=semver,pattern=v{{major}}
55+
type=raw,value=latest
5656
5757
# Build and push GPU version
5858
- name: Build and push GPU Docker image
@@ -85,10 +85,10 @@ jobs:
8585
flavor: |
8686
suffix=-ui
8787
tags: |
88-
type=semver,pattern=v{{version}}-ui
89-
type=semver,pattern=v{{major}}.{{minor}}-ui
90-
type=semver,pattern=v{{major}}-ui
91-
type=raw,value=latest-ui
88+
type=semver,pattern=v{{version}}
89+
type=semver,pattern=v{{major}}.{{minor}}
90+
type=semver,pattern=v{{major}}
91+
type=raw,value=latest
9292
9393
# Build and push UI version
9494
- name: Build and push UI Docker image

.github/workflows/sync-develop.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Sync develop with master
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
sync-develop:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
issues: write
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
ref: develop
20+
21+
- name: Configure Git
22+
run: |
23+
git config user.name "GitHub Actions"
24+
git config user.email "actions@github.com"
25+
26+
- name: Merge master into develop
27+
run: |
28+
git fetch origin master:master
29+
git merge --no-ff origin/master -m "chore: Merge master into develop branch"
30+
31+
- name: Push changes
32+
run: |
33+
if ! git push origin develop; then
34+
echo "Failed to push to develop branch"
35+
exit 1
36+
fi
37+
38+
- name: Handle Failure
39+
if: failure()
40+
uses: actions/github-script@v7
41+
with:
42+
script: |
43+
const issueBody = `Automatic merge from master to develop failed.
44+
45+
Please resolve this manually
46+
47+
Workflow run: ${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
48+
49+
await github.rest.issues.create({
50+
owner: context.repo.owner,
51+
repo: context.repo.repo,
52+
title: '🔄 Automatic master to develop merge failed',
53+
body: issueBody,
54+
labels: ['merge-failed', 'automation']
55+
});

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
Notable changes to this project will be documented in this file.
44

5+
## [v0.0.5] - 2025-01-10
6+
### Fixed
7+
- Stabilized issues with images tagging and structures from v0.0.4
8+
- Added automatic master to develop branch synchronization
9+
- Improved release tagging and structures
10+
- Initial CI/CD setup
11+
512
## 2025-01-04
613
### Added
714
- ONNX Support:

0 commit comments

Comments
 (0)