Skip to content

Commit

Permalink
Add one master CI which builds, tests and deploys (#231)
Browse files Browse the repository at this point in the history
* Add one master CI which builds, tests and deploys

* Change needs order

* Fix matrix syntax

* Change flag to 17 from 11

* Don't error if can't find

* Change wilcard pattern

* Download store output

* v3

* Check working directory

* Run ls on right section

* Switch to lowercase

* Run uname to see output

* Check OS output

* Change back the extension

* Remove the test step

* Remove ls step

* Don't specify path to library

* Don't fail fast

* Use add_dll_directory

* Fix fail fast

* Revert "Use add_dll_directory"

This reverts commit caf8cbb.

* Revert "Revert "Use add_dll_directory""

This reverts commit 1b2569d.

* Adjust DLL directory and specify path manually

* Fix DLL path

* Hardcode the path 😢

* Build windows binary

* Test adding windows binary to CI

* Fix job

* Don't download

* Fix CI tabs

* Removed needs

* Use old binary

* Undo comments

* Remove the DLL

* Remove the flags

* Check cross-compiling on Windows

* Install dependencies

* Compile on windows too

* Remove apt install

* Cross compile Windows on Linux

* Reduce jobs from 10 to 5

* Set environment variable

* Selectively install dependency

* SImplify if

* Bump codecov

* Only install mingw on certain item

* Forgot matrix.

* Add windows cross compile to name

* Wrap the if statements

* Try `if: true`

* Fix whitespace

* Update first

* Try templating the name

* Revert "Try templating the name"

This reverts commit 21b8662.

* Fail fast == true

* Remove whitespace

* Change indent
  • Loading branch information
paddyroddy authored Mar 21, 2023
1 parent 1d09619 commit c9c413f
Show file tree
Hide file tree
Showing 10 changed files with 158 additions and 126 deletions.
135 changes: 135 additions & 0 deletions .github/workflows/build_wheels_test_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Build Wheels, Test & Deploy

on:
push:
branches:
- main
pull_request:
paths-ignore:
- "**.md"
- "**.rst"

jobs:
build_wheels:
name: |
Build wheels on ${{ matrix.os }} with
windows_cross_compile=${{ matrix.windows_cross_compile }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
windows_cross_compile: [false, true]
exclude:
- os: macos-latest
windows_cross_compile: true

steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64
if: matrix.windows_cross_compile

- uses: actions/checkout@v3

- name: Build wheels
run: bash build.sh
env:
WINDOWS_CROSS_COMPILE: ${{ matrix.windows_cross_compile }}

- name: Upload artefacts
uses: actions/upload-artifact@v3
with:
name: artefacts
path: |
btrack/libs/*
if-no-files-found: error

test:
needs: build_wheels
name: ${{ matrix.os }} py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest]
# Include one windows and macos run
include:
- os: macos-latest
python-version: "3.10"
- os: windows-latest
python-version: "3.10"

steps:
- uses: actions/checkout@v3

- name: Download artefacts
uses: actions/download-artifact@v3
with:
name: artefacts
path: btrack/libs

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: "pyproject.toml"

- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: "3.10"

# note: if you need dependencies from conda, considering using
# setup-miniconda: https://github.com/conda-incubator/setup-miniconda
# and
# tox-conda: https://github.com/tox-dev/tox-conda
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install "tox<4" tox-gh-actions tox-conda
- name: Test with tox
run: tox

- name: Coverage
uses: codecov/codecov-action@v3

deploy:
needs: test
runs-on: "ubuntu-latest"
if: |
github.repository == 'quantumjot/btrack'
&& github.event_name == 'push'
&& startsWith(github.ref, 'refs/tags')
steps:
- name: Checkout source
uses: actions/checkout@v3

- name: Download artefacts
uses: actions/download-artifact@v3
with:
name: artefacts
path: btrack/libs

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: "pyproject.toml"

- name: Install build dependencies
run: python -m pip install build wheel

- name: Build distributions
shell: bash -l {0}
run: python -m build

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
32 changes: 0 additions & 32 deletions .github/workflows/deploy.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: checks
name: Linting

on: [push, pull_request]

Expand Down
70 changes: 0 additions & 70 deletions .github/workflows/test.yml

This file was deleted.

8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
btrack/include/eigen
btrack/__pycache__
btrack/optimise/__pycache__
__pycache__
btrack/agents.py
btrack/render_movie.py
models/MDCK_*
examples/napari.png
examples/.ipynb_checkpoints
*.ipynb_checkpoints
models/test_config.json
notebooks
deprecated
Expand All @@ -25,3 +24,6 @@ docs/api/*
coverage.xml
.envrc
.hypothesis
*.DLL
*.dylib
*.so
33 changes: 17 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
UNAME := $(shell uname)

ifeq ($(UNAME), Linux)
# do something Linux #-fopenmp -static
CXX = g++
EXT = so
XLDFLAGS = -Wl,--no-undefined -Wl,--no-allow-shlib-undefined
#-L/usr/local/cuda/lib64 -lcuda -lcudart
ifeq ($(WINDOWS_CROSS_COMPILE),true)
# do something Windowsy
CXX = x86_64-w64-mingw32-g++
EXT = DLL
XLDFLAGS = -static-libgcc -static-libstdc++
else
# do something Linux #-fopenmp -static
CXX = g++
EXT = so
XLDFLAGS = -Wl,--no-undefined -Wl,--no-allow-shlib-undefined
#-L/usr/local/cuda/lib64 -lcuda -lcudart
endif
endif
ifeq ($(UNAME), Darwin)
# do something OSX
CXX = clang++ -arch x86_64 -arch arm64
EXT = dylib
XLD_FLAGS = -arch x86_64 -arch arm64
endif
ifeq ($(UNAME), Windows)
# do something Windowsy
CXX = x86_64-w64-mingw32-g++
EXT = DLL
XLDFLAGS = -static-libgcc -static-libstdc++
endif

NVCC = nvcc

Expand All @@ -29,13 +30,13 @@ VERSION_MAJOR = $(shell cat $(VERSION_FILE) | cut -f1 -d.)
VERSION_MINOR = $(shell cat $(VERSION_FILE) | cut -f2 -d.)
VERSION_BUILD = $(shell cat $(VERSION_FILE) | cut -f3 -d.)

# If your compiler is a bit older you may need to change -std=c++11 to -std=c++0x
# If your compiler is a bit older you may need to change -std=c++17 to -std=c++0x
#-I/usr/include/python2.7 -L/usr/lib/python2.7 # -O3
LLDBFLAGS =
CXXFLAGS = -c -std=c++11 -m64 -fPIC -I"./btrack/include" \
-DDEBUG=false -DVERSION_MAJOR=$(VERSION_MAJOR) \
-DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_BUILD=$(VERSION_BUILD) \
-DBUILD_SHARED_LIB
CXXFLAGS = -c -std=c++17 -m64 -fPIC -I"./btrack/include" \
-DDEBUG=false -DVERSION_MAJOR=$(VERSION_MAJOR) \
-DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_BUILD=$(VERSION_BUILD) \
-DBUILD_SHARED_LIB
OPTFLAGS = -O3
LDFLAGS = -shared $(XLDFLAGS)

Expand Down
Binary file removed btrack/libs/libtracker.DLL
Binary file not shown.
Binary file removed btrack/libs/libtracker.dylib
Binary file not shown.
Binary file removed btrack/libs/libtracker.so
Binary file not shown.
4 changes: 0 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,3 @@ fi
echo "Compiling btrack from source..."
make clean
make

# run the installation
echo "Installing btrack python package..."
pip install -e .

0 comments on commit c9c413f

Please sign in to comment.