Skip to content

Commit

Permalink
Migrate from circleci to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
thodkatz committed Sep 4, 2024
1 parent cdb2c4a commit 65ada37
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 133 deletions.
128 changes: 0 additions & 128 deletions .circleci/config.yml

This file was deleted.

133 changes: 133 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
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 }}
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: mamba 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 Test
run: |
mkdir -p ./pkgs/noarch
conda build -c conda-forge conda-recipe --no-test --output-folder ./pkgs
test-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: mamba 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 pytorch -c ilastik-forge -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 pytorch -c ilastik-forge -c conda-forge \
./pkgs/noarch/${TIKTORCH_PACKAGE_NAME}
- name: Windows Test
if: matrix.os == 'windows-latest'
shell: cmd /C CALL {0}
run: |
dir .\pkgs
dir .\pkgs\noarch
conda info
conda build -h
conda build --test --override-channels ^
-c .\pkgs -c pytorch -c ilastik-forge -c conda-forge ^
.\pkgs\noarch\%TIKTORCH_PACKAGE_NAME%
1 change: 1 addition & 0 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ requirements:
- {{ 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() }}
Expand Down
9 changes: 5 additions & 4 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ dependencies:

# pytorch
# remove cpuonly, add cudatoolkit and cudnn for gpu support
- pytorch=1.13.*
- inferno=v0.4.*
- pytorch=2.4.*
# currently it's necessary to force the cpu version, remove
# torchvision pin when going for gpu
# - torchvision
#- cpuonly
- cpuonly
# - cudatoolkit >=10.2
# - cudnn
# - tochvision
Expand All @@ -50,6 +49,8 @@ dependencies:
- mypy
- pre_commit

- mkl <2024.1.0 # [linux] until pytorch is compatible with the current version

- setuptools
- pip

- mkl <2024.1.0 # [linux] until pytorch is compatible with the current version
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
],
extras_require={
"server-pytorch": [
"inferno",
"pytorch>=1.6",
"scikit-learn",
],
Expand Down

0 comments on commit 65ada37

Please sign in to comment.