Skip to content

Commit

Permalink
Merge pull request #217 from ilastik/ci-multiple-os
Browse files Browse the repository at this point in the history
Migrate from circleci to github actions
  • Loading branch information
thodkatz authored Sep 16, 2024
2 parents 3eb9148 + 8f4fa85 commit 7dc4196
Show file tree
Hide file tree
Showing 11 changed files with 229 additions and 178 deletions.
124 changes: 0 additions & 124 deletions .circleci/config.yml

This file was deleted.

172 changes: 172 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
pre_commit_check:
name: Pre-Commit Check
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
auto-activate-base: false
activate-environment: tiktorch-server-env
environment-file: environment.yml
channel-priority: flexible
miniforge-variant: Miniforge3
- name: Run Pre-Commit
run: |
echo $BRANCH_NAME
echo ${{ github.event.pull_request.base.ref }}
echo ${{ github.event.pull_request.head.sha }}
git fetch origin
pre-commit run --from-ref origin/${{ github.event.pull_request.base.ref }} --to-ref ${{ github.event.pull_request.head.sha }}
test-dev:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
auto-activate-base: false
activate-environment: tiktorch-server-env
environment-file: environment.yml
channel-priority: flexible
miniforge-variant: Miniforge3
- name: conda diagnostics
run: |
conda list
conda info
- name: install submodules
run: |
git submodule init
git submodule update
make install_submodules
- name: Run tests
run: |
pytest -v -s --cov=tiktorch --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}


conda-noarch-build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
auto-activate-base: true
channel-priority: flexible
miniforge-variant: Miniforge3
- name: install common conda dependencies
run: conda install -n base -c conda-forge conda-build setuptools_scm -y
- name: Cache Conda Packages
uses: actions/cache@v4
with:
path: |
pkgs/noarch
pkgs/channeldata.json
key: ${{ github.sha }}-packages
- id: version
run: |
vers=$( python setup.py --version )
echo "version=${vers}" >> $GITHUB_OUTPUT
- name: Linux Conda Build
run: |
mkdir -p ./pkgs/noarch
conda build -c ilastik-forge -c pytorch -c conda-forge \
conda-recipe --no-test --output-folder ./pkgs
test-build-conda-packages:
needs: [conda-noarch-build]
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
env:
TIKTORCH_PACKAGE_NAME: tiktorch-${{ needs.conda-noarch-build.outputs.version }}-py_0.tar.bz2
steps:
# Use GNU tar instead of BSD tar on Windows
- name: "Use GNU tar instead of BSD tar"
if: matrix.os == 'windows-latest'
shell: cmd
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
auto-activate-base: true
channel-priority: flexible
miniforge-variant: Miniforge3
- name: install common conda dependencies
run: conda install -n base -c conda-forge conda-build setuptools_scm -y
- name: Cache Conda Packages
uses: actions/cache@v4
with:
path: |
pkgs/noarch
pkgs/channeldata.json
key: ${{ github.sha }}-packages
enableCrossOsArchive: true
- name: Linux Test
if: matrix.os == 'ubuntu-latest'
shell: bash -l {0}
run: |
conda build --test --override-channels \
-c ./pkgs -c ilastik-forge -c pytorch -c conda-forge \
./pkgs/noarch/${TIKTORCH_PACKAGE_NAME}
- name: macOS Test
if: matrix.os == 'macos-latest'
shell: bash -l {0}
run: |
conda build --test --override-channels \
-c ./pkgs -c ilastik-forge -c pytorch -c conda-forge \
./pkgs/noarch/${TIKTORCH_PACKAGE_NAME}
- name: Windows Test
if: matrix.os == 'windows-latest'
# HACK: due to a bug in conda-build need to point to
# libarchive explicitly.
# https://github.com/conda/conda/issues/12563#issuecomment-1494264704
env:
LIBARCHIVE: C:\Miniconda\Library\bin\archive.dll
shell: cmd /C CALL {0}
run: |
conda build --test --override-channels ^
-c %CD%\pkgs -c ilastik-forge -c pytorch -c conda-forge ^
.\pkgs\noarch\%TIKTORCH_PACKAGE_NAME%
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ install_submodules:
remove_devenv:
conda env remove --yes --name $(TIKTORCH_ENV_NAME)


.PHONY: *
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
[![CircleCI](https://circleci.com/gh/ilastik/tiktorch.svg?style=shield)](https://circleci.com/gh/ilastik/tiktorch)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Conda](https://anaconda.org/ilastik-forge/tiktorch/badges/version.svg)](https://anaconda.org/ilastik-forge/tiktorch)
[![codecov](https://codecov.io/gh/ilastik/tiktorch/branch/main/graph/badge.svg)](https://codecov.io/gh/ilastik/tiktorch)

`tiktorch` is the neural network prediction server for [`ilastik`](https://ilastik.org).
The server is used in the [Neural Network Workflow](https://www.ilastik.org/documentation/nn/nn).
Expand Down
30 changes: 18 additions & 12 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,26 @@ source:
build:
noarch: python
number: 0
script: python -m pip install --no-deps --ignore-installed .
script:
- python -m pip install . --no-deps --ignore-installed --no-cache-dir -vvv
entry_points:
- tiktorch-server = tiktorch.server.base:main

requirements:
host:
- pip
- python >=3.7
- python >=3.8
run:
- python >=3.7
- pickle5 # [py37]
- python >=3.8
{% for dep in setup_py_data['install_requires'] %}
- {{ dep.lower() }}
{% endfor %}
run_constrained:
- mkl <2024.1.0 # [linux] until pytorch is compatible with the current version
- cudatoolkit >=10.2
{% for dep in setup_py_data['extras_require']['server-pytorch'] %}
- {{ dep.lower() }}
{% endfor %}
{% for dep in setup_py_data['extras_require']['server-tensorflow'] %}
- {{ dep.lower() }}
{% endfor %}

about:
home: https://github.com/ilastik/tiktorch
Expand All @@ -52,12 +50,11 @@ test:
{% for dep in setup_py_data['extras_require']['server-pytorch'] %}
- {{ dep.lower() }}
{% endfor %}
{% for dep in setup_py_data['extras_require']['server-tensorflow'] %}
- {{ dep.lower() }}
{% endfor %}
# this is still necessary, torchvision doesn't work properly with cpuonly mutex
- torchvision=*=*cpu
- python 3.9.*
- pytest
- pytest-grpc
- cpuonly
- ilastik-pytorch-version-helper-cpu
imports:
# client
- tiktorch
Expand All @@ -70,3 +67,12 @@ test:
# server
- tiktorch.server.base
- tiktorch.server.session

source_files:
- tests
- tiktorch
- pytest.ini

commands:
- pytest

Loading

0 comments on commit 7dc4196

Please sign in to comment.