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
97 changes: 97 additions & 0 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: test

on: [push]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install python v${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install dependencies
run: |
python -m pip install -r tests/requirements.txt
sudo apt update && sudo apt install ffmpeg -y

- name: Run Tests
run: |
python -m unittest discover

# see https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
build:
name: Build distribution 📦
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') # only build on tag pushes
needs:
- test

steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

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

- name: Check version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
PACKAGE_VERSION=$(grep -Po 'version\s*=\s*["\x27]\K[^"\x27]+' setup.py)
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
echo "Version mismatch! GitHub tag is $TAG_VERSION but package version is $PACKAGE_VERSION."
exit 1
fi

- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user

- name: Build a binary wheel and a source tarball
run: python3 -m build

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

release:
name: >-
Publish Python 🐍 distribution 📦 to PyPI and Github
if: startsWith(github.ref, 'refs/tags/v') # only publish on version tag pushes
needs:
- build
runs-on: ubuntu-latest

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.DF3D_PYPI_API_TOKEN }}

- name: Make Github release
uses: softprops/action-gh-release@v2
30 changes: 0 additions & 30 deletions .github/workflows/test.yml

This file was deleted.

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ We previously published our DeepFly3D work on eLife journal. You can read the pu
- [Calibration](#calibration)
- [Running GUI](#running-gui)
- [Development](#development)
- [Releasing a new version](#releasing-a-new-version)
- [References](#references)
- [Version History](#version-history)
- [Changes in 0.5](#changes-in-05)
Expand Down Expand Up @@ -465,6 +466,12 @@ DeepFly3D consists of 3 pip packages:

The master branch of the DeepFly3D package is kept up-to-date with the last version of the pip package. Development is done under dev branch. Before pushing changes to the master branch, make sure all test cases are passing. You can run the tests using `python -m unittest discover`. Unittests make sure several scenarios can be processed using cli without failing.

# Releasing a new version

1. Update the version in `setup.py` (eg. 1.0.1)
2. Create a tag for the release that matches the new version (eg. v1.0.1)
3. Push the latest commit and tag - this will trigger a github action to make a new release for DeepFly3D on pypi and github
4. Edit the github release https://github.com/NeLy-EPFL/DeepFly3D/releases to add information about the latest changes

# References
You can cite our paper in case you find it useful.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="nely-df3d",
version="1.0.0",
version="1.0.1.dev4",
description="GUI and 3D pose estimation pipeline for tethered Drosophila.",
author="Semih Gunel",
author_email="gunelsemih@gmail.com",
Expand Down