Skip to content

Commit 2d5b42c

Browse files
committed
Migrate from circleci to github actions
1 parent 3eb9148 commit 2d5b42c

7 files changed

Lines changed: 203 additions & 23 deletions

File tree

.github/workflows/ci.yml

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
pre_commit_check:
13+
name: Pre-Commit Check
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
shell: bash -l {0}
18+
env:
19+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
- uses: conda-incubator/setup-miniconda@v3
24+
with:
25+
auto-update-conda: true
26+
auto-activate-base: false
27+
activate-environment: tiktorch-server-env
28+
environment-file: environment.yml
29+
channel-priority: flexible
30+
miniforge-variant: Miniforge3
31+
- name: Run Pre-Commit
32+
run: |
33+
echo $BRANCH_NAME
34+
echo ${{ github.event.pull_request.base.ref }}
35+
echo ${{ github.event.pull_request.head.sha }}
36+
git fetch origin
37+
pre-commit run --from-ref origin/${{ github.event.pull_request.base.ref }} --to-ref ${{ github.event.pull_request.head.sha }}
38+
39+
test-dev:
40+
runs-on: ubuntu-latest
41+
defaults:
42+
run:
43+
shell: bash -l {0}
44+
steps:
45+
- name: Checkout code
46+
uses: actions/checkout@v4
47+
- uses: conda-incubator/setup-miniconda@v3
48+
with:
49+
auto-update-conda: true
50+
auto-activate-base: false
51+
activate-environment: tiktorch-server-env
52+
environment-file: environment.yml
53+
channel-priority: flexible
54+
miniforge-variant: Miniforge3
55+
- name: conda diagnostics
56+
run: |
57+
conda info
58+
- name: install submodules
59+
run: |
60+
git submodule init
61+
git submodule update
62+
make install_submodules
63+
- name: Run tests
64+
run: |
65+
pytest -v -s --cov=tiktorch --cov-report=xml
66+
- name: Upload coverage to Codecov
67+
uses: codecov/codecov-action@v4
68+
with:
69+
file: ./coverage.xml
70+
fail_ci_if_error: true
71+
env:
72+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
73+
74+
75+
conda-noarch-build:
76+
runs-on: ubuntu-latest
77+
outputs:
78+
version: ${{ steps.version.outputs.version }}
79+
defaults:
80+
run:
81+
shell: bash -l {0}
82+
steps:
83+
- uses: actions/checkout@v4
84+
with:
85+
fetch-depth: 0
86+
- uses: conda-incubator/setup-miniconda@v3
87+
with:
88+
auto-update-conda: true
89+
auto-activate-base: true
90+
channel-priority: flexible
91+
miniforge-variant: Miniforge3
92+
- name: install common conda dependencies
93+
run: mamba install -n base -c conda-forge conda-build setuptools_scm -y
94+
- name: Cache Conda Packages
95+
uses: actions/cache@v4
96+
with:
97+
path: |
98+
pkgs/noarch
99+
pkgs/channeldata.json
100+
key: ${{ github.sha }}-packages
101+
- id: version
102+
run: |
103+
vers=$( python setup.py --version )
104+
echo "version=${vers}" >> $GITHUB_OUTPUT
105+
- name: Linux Conda Build Test
106+
run: |
107+
mkdir -p ./pkgs/noarch
108+
conda build -c conda-forge conda-recipe --no-test --output-folder ./pkgs
109+
110+
test-build-conda-packages:
111+
needs: [conda-noarch-build]
112+
strategy:
113+
fail-fast: false
114+
matrix:
115+
os: [macos-latest, windows-latest, ubuntu-latest]
116+
runs-on: ${{ matrix.os }}
117+
env:
118+
TIKTORCH_PACKAGE_NAME: tiktorch-${{ needs.conda-noarch-build.outputs.version }}-py_0.tar.bz2
119+
steps:
120+
# Use GNU tar instead of BSD tar on Windows
121+
- name: "Use GNU tar instead of BSD tar"
122+
if: matrix.os == 'windows-latest'
123+
shell: cmd
124+
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
125+
- name: Checkout code
126+
uses: actions/checkout@v4
127+
with:
128+
fetch-depth: 0
129+
- uses: conda-incubator/setup-miniconda@v3
130+
with:
131+
auto-update-conda: true
132+
auto-activate-base: true
133+
channel-priority: flexible
134+
miniforge-variant: Miniforge3
135+
- name: install common conda dependencies
136+
run: mamba install -n base -c conda-forge conda-build setuptools_scm -y
137+
- name: Cache Conda Packages
138+
uses: actions/cache@v4
139+
with:
140+
path: |
141+
pkgs/noarch
142+
pkgs/channeldata.json
143+
key: ${{ github.sha }}-packages
144+
enableCrossOsArchive: true
145+
- name: Linux Test
146+
if: matrix.os == 'ubuntu-latest'
147+
shell: bash -l {0}
148+
run: |
149+
conda build --test --override-channels \
150+
-c ./pkgs -c pytorch -c ilastik-forge -c conda-forge \
151+
./pkgs/noarch/${TIKTORCH_PACKAGE_NAME}
152+
- name: macOS Test
153+
if: matrix.os == 'macos-latest'
154+
shell: bash -l {0}
155+
run: |
156+
conda build --test --override-channels \
157+
-c ./pkgs -c pytorch -c ilastik-forge -c conda-forge \
158+
./pkgs/noarch/${TIKTORCH_PACKAGE_NAME}
159+
- name: Windows Test
160+
if: matrix.os == 'windows-latest'
161+
# HACK: due to a bug in conda-build need to point to
162+
# libarchive explicitly.
163+
# https://github.com/conda/conda/issues/12563#issuecomment-1494264704
164+
env:
165+
LIBARCHIVE: C:\Miniconda\Library\bin\archive.dll
166+
shell: cmd /C CALL {0}
167+
run: |
168+
conda build --test --override-channels ^
169+
-c %CD%\pkgs -c pytorch -c ilastik-forge -c conda-forge ^
170+
.\pkgs\noarch\%TIKTORCH_PACKAGE_NAME%

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,4 @@ install_submodules:
2828
remove_devenv:
2929
conda env remove --yes --name $(TIKTORCH_ENV_NAME)
3030

31-
3231
.PHONY: *

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
[![CircleCI](https://circleci.com/gh/ilastik/tiktorch.svg?style=shield)](https://circleci.com/gh/ilastik/tiktorch)
33
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
44
[![Conda](https://anaconda.org/ilastik-forge/tiktorch/badges/version.svg)](https://anaconda.org/ilastik-forge/tiktorch)
5+
[![codecov](https://codecov.io/gh/ilastik/tiktorch/branch/main/graph/badge.svg)](https://codecov.io/gh/ilastik/tiktorch)
56

67
`tiktorch` is the neural network prediction server for [`ilastik`](https://ilastik.org).
78
The server is used in the [Neural Network Workflow](https://www.ilastik.org/documentation/nn/nn).

conda-recipe/meta.yaml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ source:
1515
build:
1616
noarch: python
1717
number: 0
18-
script: python -m pip install --no-deps --ignore-installed .
18+
script:
19+
- python -m pip install . --no-deps --ignore-installed --no-cache-dir -vvv
1920
entry_points:
2021
- tiktorch-server = tiktorch.server.base:main
2122

@@ -30,13 +31,11 @@ requirements:
3031
- {{ dep.lower() }}
3132
{% endfor %}
3233
run_constrained:
34+
- mkl <2024.1.0 # [linux] until pytorch is compatible with the current version
3335
- cudatoolkit >=10.2
3436
{% for dep in setup_py_data['extras_require']['server-pytorch'] %}
3537
- {{ dep.lower() }}
3638
{% endfor %}
37-
{% for dep in setup_py_data['extras_require']['server-tensorflow'] %}
38-
- {{ dep.lower() }}
39-
{% endfor %}
4039

4140
about:
4241
home: https://github.com/ilastik/tiktorch
@@ -52,12 +51,10 @@ test:
5251
{% for dep in setup_py_data['extras_require']['server-pytorch'] %}
5352
- {{ dep.lower() }}
5453
{% endfor %}
55-
{% for dep in setup_py_data['extras_require']['server-tensorflow'] %}
56-
- {{ dep.lower() }}
57-
{% endfor %}
5854
# this is still necessary, torchvision doesn't work properly with cpuonly mutex
5955
- torchvision=*=*cpu
60-
- cpuonly
56+
- pytest
57+
- pytest-grpc
6158
imports:
6259
# client
6360
- tiktorch
@@ -70,3 +67,12 @@ test:
7067
# server
7168
- tiktorch.server.base
7269
- tiktorch.server.session
70+
71+
source_files:
72+
- tests
73+
- tiktorch
74+
- pytest.ini
75+
76+
commands:
77+
- pytest
78+

environment.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,23 @@ dependencies:
1313
- marshmallow=3.12.*
1414
- marshmallow-jsonschema
1515
- protobuf
16-
- pytest
17-
- pytest-grpc
1816
- pyyaml=5.3.*
1917
- requests
2018
- ruamel.yaml
2119
- scikit-learn
2220
- scipy
2321
- typing-extensions
2422
- xarray
23+
- setuptools
24+
- pip
2525

2626
# pytorch
2727
# remove cpuonly, add cudatoolkit and cudnn for gpu support
28-
- pytorch=1.13.*
29-
- inferno=v0.4.*
28+
- pytorch=2.4.*
3029
# currently it's necessary to force the cpu version, remove
3130
# torchvision pin when going for gpu
3231
# - torchvision
33-
#- cpuonly
32+
- cpuonly
3433
# - cudatoolkit >=10.2
3534
# - cudnn
3635
# - tochvision
@@ -46,10 +45,14 @@ dependencies:
4645
- typer
4746

4847
# dev stuff
48+
- pytest
49+
- pytest-cov
50+
- pytest-grpc
4951
- bump2version
5052
- mypy
5153
- pre_commit
5254

53-
- pip
54-
5555
- mkl <2024.1.0 # [linux] until pytorch is compatible with the current version
56+
57+
58+

pytest.ini

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
[pytest]
2-
add_opts = -s --doctest-modules
2+
python_files = test_*.py
3+
addopts =
4+
-v
5+
-s
6+
--color=yes
7+
--doctest-modules
8+
--ignore=tests/data
39
testpaths = tests
410
#log_format = %(asctime)s.%(msecs)03d %(levelname)s %(message)s
511
#log_date_format = %M:%S.%f

setup.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,9 @@
3737
],
3838
extras_require={
3939
"server-pytorch": [
40-
"inferno",
4140
"pytorch>=1.6",
4241
"scikit-learn",
43-
],
44-
"server-tensorflow": [
45-
"tensorflow>=2.9",
46-
"scikit-learn",
47-
],
42+
]
4843
},
4944
entry_points={"console_scripts": ["tiktorch=tiktorch.server.base:main"]},
5045
# extras_require={"test": ["pytest"]},

0 commit comments

Comments
 (0)