-
Notifications
You must be signed in to change notification settings - Fork 11
173 lines (167 loc) · 5.35 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
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}
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: Get the latest commit hash and target ref
run: |
echo "COMMIT_HASH=$(git log -1 --format='%H')" >> $GITHUB_ENV
echo "REF=${{ github.event.pull_request.base.ref || github.ref_name }}" >> $GITHUB_ENV
- name: Run Pre-Commit
run: |
echo $REF
echo $COMMIT_HASH
git fetch origin
pre-commit run --from-ref origin/$REF --to-ref $COMMIT_HASH
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%