Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"type-enum": [
2,
"always",
[
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test"
]
],
"subject-case": [2, "never", ["upper-case", "pascal-case"]],
"subject-empty": [2, "never"],
"subject-full-stop": [2, "never", "."],
"header-max-length": [2, "always", 72],
"body-leading-blank": [2, "always"],
"footer-leading-blank": [2, "always"]
}
}
34 changes: 0 additions & 34 deletions .github/workflows/build-publish-pypi.yml

This file was deleted.

62 changes: 62 additions & 0 deletions .github/workflows/semantic-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Semantic Release

on:
push:
branches:
- master
- main

permissions:
contents: write
issues: write
pull-requests: write

jobs:
release:
runs-on: ubuntu-latest
concurrency: release

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
run: |
poetry install

- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@v9.12.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}
182 changes: 182 additions & 0 deletions .github/workflows/sync-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
name: Sync Develop with Master

on:
workflow_run:
workflows: ["Semantic Release"]
types:
- completed
branches:
- master

permissions:
contents: write
pull-requests: write

jobs:
sync-develop:
runs-on: ubuntu-latest
# Only run if semantic release succeeded and actually released
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Fetch all branches
run: |
git fetch origin master:master
git fetch origin develop:develop

- name: Check if develop is behind master
id: check
run: |
git checkout develop
BEHIND=$(git rev-list --count develop..master)
echo "commits_behind=$BEHIND" >> $GITHUB_OUTPUT

if [ "$BEHIND" -eq "0" ]; then
echo "Develop is already up to date with master"
echo "needs_sync=false" >> $GITHUB_OUTPUT
else
echo "Develop is $BEHIND commits behind master"
echo "needs_sync=true" >> $GITHUB_OUTPUT
fi

- name: Attempt automatic merge
id: merge
if: steps.check.outputs.needs_sync == 'true'
run: |
git checkout develop

# Try to merge master into develop
if git merge master --no-edit; then
echo "Merge successful - no conflicts"
echo "status=success" >> $GITHUB_OUTPUT
echo "has_conflicts=false" >> $GITHUB_OUTPUT
else
echo "Merge has conflicts"
git merge --abort
echo "status=conflict" >> $GITHUB_OUTPUT
echo "has_conflicts=true" >> $GITHUB_OUTPUT
fi

- name: Push changes if no conflicts
if: steps.merge.outputs.status == 'success'
run: |
git push origin develop
echo "✅ Successfully synced develop with master"

- name: Get latest version tag
id: version
if: steps.merge.outputs.has_conflicts == 'true'
run: |
VERSION=$(git describe --tags --abbrev=0 master)
echo "tag=$VERSION" >> $GITHUB_OUTPUT

- name: Create PR if conflicts exist
if: steps.merge.outputs.has_conflicts == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: sync/master-to-develop-${{ steps.version.outputs.tag }}
base: develop
title: "chore: sync develop with master ${{ steps.version.outputs.tag }}"
body: |
## 🔄 Automatic Sync: Master → Develop

This PR syncs `develop` branch with the latest release from `master`.

**Release Version:** `${{ steps.version.outputs.tag }}`
**Triggered by:** Semantic Release workflow completion

### ⚠️ Merge Conflicts Detected

Automatic merge failed due to conflicts. Please resolve conflicts manually:

```bash
git checkout develop
git pull origin develop
git merge master
# Resolve conflicts
git add .
git commit
git push origin develop
```

### Changes from Master:
- Updated version files (`pyproject.toml`, `__version__.py`)
- Updated `CHANGELOG.md`
- New release tag: `${{ steps.version.outputs.tag }}`

---

🤖 This PR was created automatically by the sync-develop workflow.
labels: |
chore
sync
automated
assignees: ${{ github.repository_owner }}

- name: Add comment with instructions
if: steps.merge.outputs.has_conflicts == 'true'
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.pr.outputs.pull-request-number }}
body: |
### 📋 Manual Merge Instructions

Since automatic merge failed, follow these steps:

1. **Checkout and update develop:**
```bash
git checkout develop
git pull origin develop
```

2. **Merge master:**
```bash
git merge master
```

3. **Resolve conflicts** in:
- `pyproject.toml` (keep master version)
- `deeptab/__version__.py` (keep master version)
- `CHANGELOG.md` (merge both)
- Any other conflicting files

4. **Complete the merge:**
```bash
git add .
git commit -m "chore: sync develop with master ${{ steps.version.outputs.tag }}"
git push origin develop
```

5. **Close this PR** (changes will be in develop)

💡 **Tip:** Version files should always use master's values after a release.

- name: Summary
if: always()
run: |
echo "## Sync Develop Workflow Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [ "${{ steps.check.outputs.needs_sync }}" == "false" ]; then
echo "✅ Develop is already up to date with master" >> $GITHUB_STEP_SUMMARY
elif [ "${{ steps.merge.outputs.status }}" == "success" ]; then
echo "✅ Successfully merged master into develop automatically" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Commits synced:** ${{ steps.check.outputs.commits_behind }}" >> $GITHUB_STEP_SUMMARY
elif [ "${{ steps.merge.outputs.has_conflicts }}" == "true" ]; then
echo "⚠️ Merge conflicts detected - PR created for manual resolution" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Action required:** Review and merge the auto-created PR" >> $GITHUB_STEP_SUMMARY
fi
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,5 @@ examples/lightning_logs
docs/_build/doctrees/*
docs/_build/html/*


dev
dev/*
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ repos:
- yaml
- markdown
- json

- repo: https://github.com/commitizen-tools/commitizen
rev: v3.29.1
hooks:
- id: commitizen
stages: [commit-msg]
Loading
Loading