-
Notifications
You must be signed in to change notification settings - Fork 1
110 lines (96 loc) · 3.64 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
name: TileDB-BioImaging CI
on: [push]
jobs:
build:
name: ${{ matrix.sys.os }}
runs-on: ${{ matrix.sys.os }}
timeout-minutes: 25
strategy:
matrix:
sys:
- { os: windows-latest, shell: 'cmd /C call {0}' }
- { os: ubuntu-latest, shell: "bash -l {0}" }
fail-fast: false
defaults:
run:
shell: ${{ matrix.sys.shell }}
env:
run_coverage: ${{ github.ref == 'refs/heads/main' }}
outputs:
coverage: ${{ steps.stats.outputs.coverage }}
steps:
- uses: actions/checkout@v2
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1.9.0
with:
micromamba-version: 1.5.10-0
environment-name: test
cache-downloads: true
create-args: >-
python=3.9
pre-commit
pytest-cov
pytest-mock
- name: Install openslide for non-Win
run: |
sudo apt install openslide-tools
micromamba install openslide
echo ${{ matrix.sys.os }}
if: ${{ matrix.sys.os != 'windows-latest' }}
- name: Install openslide for Win
run: |
choco install wget --no-progress
wget https://github.com/openslide/openslide-winbuild/releases/download/v20221217/openslide-win64-20221217.zip
7z x openslide-win64-20221217.zip -oD:\openslide\
mklink /D C:\openslide-win64\ D:\openslide\openslide-win64-20221217\
cd C:\openslide-win64\
dir
set openslide_path=%cd%
echo %openslide_path%
if: ${{ matrix.sys.os == 'windows-latest' }}
- name: Run pre-commit hooks
run: |
micromamba run -n test pre-commit run -a
- name: Install package
shell: "bash -l {0}"
run: |
pip install --no-cache-dir --upgrade tifffile "imagecodecs>=2023.7.10"
pip install .[full]
- name: Run tests with coverage
id: stats
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
: # This GITHUB_WORKSPACE is bydefault set to D: driver whereas pytest's tmp_dir
: # default is C: ,thus we create a temp_test folder for pytest's tmp_dir to run on D: as well
pytest -v --cov=tiledb --cov-report=term-missing --durations=0 tests/ > coverage.txt
exit_code=$?
TEST_COVERAGE="$(grep '^TOTAL' coverage.txt | awk -v N=4 '{print $N}')"
echo "coverage=$TEST_COVERAGE" >> $GITHUB_OUTPUT
exit $exit_code
if: ${{ matrix.sys.os != 'windows-latest' }}
- name: Run tests with coverage WINDOWS
id: stats-win
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
mkdir test_temp
micromamba run -n test pytest --basetemp=test_temp -v --cov=tiledb --cov-report=term-missing --durations=0 tests/ --ignore=tests/integration/converters/test_ome_tiff_experimental.py
if: ${{ matrix.sys.os == 'windows-latest' }}
- name: Run notebook examples
run: |
micromamba run -n test pip install opencv-python-headless matplotlib nbmake
micromamba run -n test pytest --nbmake examples
- name: Create Test Coverage Badge
if: ${{ fromJSON(env.run_coverage) && matrix.sys.os == 'ubuntu-latest'}}
uses: schneegans/dynamic-badges-action@v1.1.0
with:
auth: ${{ secrets.COVERAGE_SECRET }}
gistID: 32d48185733a4e7375e80e3e35fab452
filename: gist_bioimg.json
label: Test Coverage
message: ${{ steps.stats.outputs.coverage }}
color: green
namedLogo: pytest