-
-
Notifications
You must be signed in to change notification settings - Fork 471
148 lines (140 loc) · 5.66 KB
/
master-push.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
name: Push to master
on:
push:
branches:
- master
- master-workflow # Testing during development of the workflow
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.6, 3.7, 3.8]
jpeg-deps: [pillow-jpegls]
gdcm-dep: [no-gdcm]
include:
- { gdcm-dep: gdcm, os: ubuntu-latest, python-version: 3.6, jpeg-deps: no-pillow-jpegls }
- { gdcm-dep: gdcm, os: ubuntu-latest, python-version: 3.7, jpeg-deps: no-pillow-jpegls }
- { gdcm-dep: gdcm, os: ubuntu-latest, python-version: 3.8, jpeg-deps: no-pillow-jpegls }
- { pymedphys-dep: pymedphys, gdcm-dep: gdcm, os: ubuntu-latest, python-version: 3.8, jpeg-deps: pillow-jpegls }
# Test all pixel data handlers for code coverage
- os: ubuntu-latest
python-version: 3.9
jpeg-deps: pillow-jpegls
gdcm-dep: gdcm
pylibjpeg-dep: pylibjpeg
ext-sources: pydicom-data
pytest-args: --cov=pydicom --cov-append
coverage: coverage
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Get pip cache dir
id: pip-cache
run: |
python -m pip install -U pip # to ensure version > 20 to have cache dir
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: py${{ matrix.python-version }}-${{ matrix.os }}-pip
- name: Cache pydicom test data
id: cache-testdata
uses: actions/cache@v2
with:
path: ${{ env.HOME }}/.pydicom
key: pydicom-testdata
- name: Initial test environment setup
run: |
python -m pip install -e .
python -m pip install wheel
python -m pip install pytest pytest-cov
- name: Test with no external libraries
run: |
pytest ${{ matrix.pytest-args }}
- name: Install numpy
run: |
python -m pip install numpy
- name: Test with numpy
run: |
pytest ${{ matrix.pytest-args }}
- name: Set up Pillow and jpeg_ls
if: ${{ matrix.jpeg-deps == 'pillow-jpegls' }}
run: |
python -m pip install pillow cython
python -m pip install git+https://github.com/Who8MyLunch/CharPyLS
- name: Run Pillow and jpeg_ls tests
if: ${{ matrix.jpeg-deps == 'pillow-jpegls' }}
run: |
pytest ${{ matrix.pytest-args }}
- name: Cache GDCM
id: cache-gdcm
if: ${{ matrix.gdcm-dep == 'gdcm' }}
uses: actions/cache@v2
with:
path: gdcmbin
key: GDCM-${{ matrix.os }}-python${{ matrix.python-version }}
- name: Build GDCM (if not in cache)
if: ${{ matrix.gdcm-dep == 'gdcm' && steps.cache-gdcm.outputs.cache-hit != 'true' }}
run: |
sudo apt-get install -y --no-install-recommends build-essential swig python3-dev
sudo apt-get install -y ninja-build cmake
git clone --branch release https://github.com/malaterre/GDCM.git
mkdir gdcmbin
cd gdcmbin
/usr/bin/cmake -GNinja -DGDCM_WRAP_PYTHON=ON -DGDCM_BUILD_SHARED_LIBS=ON ../GDCM
ninja
cd ..
- name: Test with GDCM
if: ${{ matrix.gdcm-dep == 'gdcm' }}
run: |
# Create super-simple setup.py for python -m pip install
echo 'from setuptools import setup; setup(name="gdcm.py")' > gdcmbin/bin/setup.py
python -m pip install -e gdcmbin/bin/
python -c 'import gdcm; print(f"Using gdcm {gdcm.GDCM_VERSION}")'
pytest ${{ matrix.pytest-args }}
- name: Install and test pylibjpeg
if: ${{ matrix.pylibjpeg-dep == 'pylibjpeg' }}
run: |
python -m pip install pylibjpeg
python -m pip uninstall -y pylibjpeg-openjpeg pylibjpeg-rle
pytest ${{ matrix.pytest-args }} pydicom/tests/test_pylibjpeg.py
python -m pip install pylibjpeg-openjpeg pylibjpeg-libjpeg pylibjpeg-rle
pytest ${{ matrix.pytest-args }} pydicom/tests/test_pylibjpeg.py
- name: Test external sources using pydicom-data
if: ${{ matrix.ext-sources == 'pydicom-data' }}
run: |
python -m pip install git+https://github.com/pydicom/pydicom-data
pytest ${{ matrix.pytest-args}} pydicom/tests/test_data_manager.py
- name: Send coverage results
if: ${{ success() && matrix.coverage == 'coverage' }}
uses: codecov/codecov-action@v1
- name: Install pymedphys
if: ${{ matrix.pymedphys-dep == 'pymedphys' }}
run: python -m pip install --pre pymedphys && python -m pip install pymedphys[user,tests]
- name: Get PyMedPhys cache directory
if: ${{ matrix.pymedphys-dep == 'pymedphys' }}
id: pymedphys-cache-location
run: |
echo "::set-output name=dir::$(python -c 'import pymedphys._config as cf; print(str(cf.get_config_dir()))')"
echo "::set-output name=version::$(python -c 'import pymedphys; print(pymedphys.__version__)')"
- name: PyMedPhys Cache
if: ${{ matrix.pymedphys-dep == 'pymedphys' }}
id: pymedphys-cache
uses: actions/cache@v2
with:
path: ${{ steps.pymedphys-cache-location.outputs.dir }}
key: pymedphys-${{ steps.pymedphys-cache-location.outputs.version }}
- name: Test pymedphys pydicom-dependent tests
if: ${{ matrix.pymedphys-dep == 'pymedphys' }}
run: |
pymedphys dev tests --run-only-pydicom
pymedphys dev tests --run-only-pydicom --run-only-slow