Skip to content

Commit 778843d

Browse files
committed
CI: Move constant env into tools/ci
1 parent 1d4e2dc commit 778843d

File tree

7 files changed

+51
-52
lines changed

7 files changed

+51
-52
lines changed

.github/workflows/misc.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,10 @@ jobs:
1818
install: ['setup']
1919
check: ['style', 'doc']
2020
pip-flags: ['']
21-
depends: ['DEFAULT_DEPENDS']
21+
depends: ['REQUIREMENTS']
2222
env:
23-
# Options
24-
SETUP_REQUIRES: 'pip setuptools>=30.3.0 wheel'
25-
# Dependencies that should always be installable
26-
DEFAULT_DEPENDS: 'numpy scipy matplotlib pillow pydicom'
27-
REQUIREMENTS: '-r requirements.txt'
28-
# Full advertised range
29-
MIN_REQUIREMENTS: '-r min-requirements.txt'
30-
MIN_REQUIREMENTS_PLUS: '-r min-requirements.txt matplotlib==1.5.3 pydicom==0.9.9 pillow==2.6'
31-
PYDICOM_MASTER: 'numpy git+https://github.com/pydicom/pydicom.git@master'
32-
# Might not find wheels for these
33-
OPTIONAL_DEPENDS: 'h5py indexed_gzip'
34-
PRE_PIP_FLAGS: '--pre --extra-index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple'
35-
# Selection
3623
DEPENDS: ${{ matrix.depends }}
24+
OPTIONAL_DEPENDS: ${{ matrix.optional-depends }}
3725
INSTALL_TYPE: ${{ matrix.install }}
3826
CHECK_TYPE: ${{ matrix.check }}
3927
EXTRA_PIP_FLAGS: ${{ matrix.pip-flags }}
@@ -51,7 +39,7 @@ jobs:
5139
- name: Display Python version
5240
run: python -c "import sys; print(sys.version)"
5341
- name: Create virtual environment
54-
run: tools/ci/create_env.sh
42+
run: tools/ci/create_venv.sh
5543
- name: Build archive
5644
run: |
5745
source tools/ci/build_archive.sh

.github/workflows/pre-release.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ jobs:
2121
install: ['setup']
2222
check: ['test']
2323
pip-flags: ['PRE_PIP_FLAGS']
24-
depends: ['DEFAULT_DEPENDS']
24+
depends: ['REQUIREMENTS']
25+
optional-depends: ['DEFAULT_OPT_DEPENDS']
2526
include:
2627
# Pydicom master
2728
- os: ubuntu-latest
2829
python-version: 3.8
2930
install: setup
3031
check: test
3132
pip-flags: ''
32-
depends: PYDICOM_MASTER
33+
depends: REQUIREMENTS
34+
optional-depends: PYDICOM_MASTER
3335
exclude:
3436
- os: ubuntu-latest
3537
architecture: x86
@@ -41,20 +43,8 @@ jobs:
4143
python-version: 3.9
4244

4345
env:
44-
# Options
45-
SETUP_REQUIRES: 'pip setuptools>=30.3.0 wheel'
46-
# Dependencies that should always be installable
47-
DEFAULT_DEPENDS: 'numpy scipy matplotlib pillow pydicom'
48-
REQUIREMENTS: '-r requirements.txt'
49-
# Full advertised range
50-
MIN_REQUIREMENTS: '-r min-requirements.txt'
51-
MIN_REQUIREMENTS_PLUS: '-r min-requirements.txt matplotlib==1.5.3 pydicom==0.9.9 pillow==2.6'
52-
PYDICOM_MASTER: 'numpy git+https://github.com/pydicom/pydicom.git@master'
53-
# Might not find wheels for these
54-
OPTIONAL_DEPENDS: 'h5py indexed_gzip'
55-
PRE_PIP_FLAGS: '--pre --extra-index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple'
56-
# Selection
5746
DEPENDS: ${{ matrix.depends }}
47+
OPTIONAL_DEPENDS: ${{ matrix.optional-depends }}
5848
INSTALL_TYPE: ${{ matrix.install }}
5949
CHECK_TYPE: ${{ matrix.check }}
6050
EXTRA_PIP_FLAGS: ${{ matrix.pip-flags }}
@@ -72,7 +62,7 @@ jobs:
7262
- name: Display Python version
7363
run: python -c "import sys; print(sys.version)"
7464
- name: Create virtual environment
75-
run: tools/ci/create_env.sh
65+
run: tools/ci/create_venv.sh
7666
- name: Build archive
7767
run: |
7868
source tools/ci/build_archive.sh

.github/workflows/stable.yml

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ jobs:
2424
install: ['setup']
2525
check: ['test']
2626
pip-flags: ['']
27-
depends: ['DEFAULT_DEPENDS']
27+
depends: ['REQUIREMENTS']
28+
optional-depends: ['DEFAULT_OPT_DEPENDS']
2829
include:
2930
# Basic dependencies only
3031
- os: ubuntu-latest
@@ -33,20 +34,23 @@ jobs:
3334
check: test
3435
pip-flags: ''
3536
depends: REQUIREMENTS
37+
optional-depends: ''
3638
# Absolute minimum dependencies
3739
- os: ubuntu-latest
3840
python-version: 3.6
3941
install: setup
4042
check: test
4143
pip-flags: ''
4244
depends: MIN_REQUIREMENTS
45+
optional-depends: ''
4346
# Absolute minimum dependencies plus old MPL, Pydicom, Pillow
4447
- os: ubuntu-latest
4548
python-version: 3.6
4649
install: setup
4750
check: test
4851
pip-flags: ''
49-
depends: MIN_REQUIREMENTS_PLUS
52+
depends: MIN_REQUIREMENTS
53+
optional-depends: MIN_OPT_DEPENDS
5054
# Clean install imports only with package-declared dependencies
5155
- os: ubuntu-latest
5256
python-version: 3.6
@@ -60,39 +64,30 @@ jobs:
6064
install: wheel
6165
check: test
6266
pip-flags: ''
63-
depends: DEFAULT_DEPENDS
67+
depends: REQUIREMENTS
68+
optional-depends: DEFAULT_OPT_DEPENDS
6469
- os: ubuntu-latest
6570
python-version: 3.8
6671
install: sdist
6772
check: test
6873
pip-flags: ''
69-
depends: DEFAULT_DEPENDS
74+
depends: REQUIREMENTS
75+
optional-depends: DEFAULT_OPT_DEPENDS
7076
- os: ubuntu-latest
7177
python-version: 3.8
7278
install: archive
7379
check: test
7480
pip-flags: ''
75-
depends: DEFAULT_DEPENDS
81+
depends: REQUIREMENTS
82+
optional-depends: DEFAULT_OPT_DEPENDS
7683
exclude:
7784
- os: ubuntu-latest
7885
architecture: x86
7986
- os: macos-latest
8087
architecture: x86
8188
env:
82-
# Options
83-
SETUP_REQUIRES: 'pip setuptools>=30.3.0 wheel'
84-
# Dependencies that should always be installable
85-
DEFAULT_DEPENDS: 'numpy scipy matplotlib pillow pydicom'
86-
REQUIREMENTS: '-r requirements.txt'
87-
# Full advertised range
88-
MIN_REQUIREMENTS: '-r min-requirements.txt'
89-
MIN_REQUIREMENTS_PLUS: '-r min-requirements.txt matplotlib==1.5.3 pydicom==0.9.9 pillow==2.6'
90-
PYDICOM_MASTER: 'numpy git+https://github.com/pydicom/pydicom.git@master'
91-
# Might not find wheels for these
92-
OPTIONAL_DEPENDS: 'h5py indexed_gzip'
93-
PRE_PIP_FLAGS: '--pre --extra-index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple'
94-
# Selection
9589
DEPENDS: ${{ matrix.depends }}
90+
OPTIONAL_DEPENDS: ${{ matrix.optional-depends }}
9691
INSTALL_TYPE: ${{ matrix.install }}
9792
CHECK_TYPE: ${{ matrix.check }}
9893
EXTRA_PIP_FLAGS: ${{ matrix.pip-flags }}
@@ -110,7 +105,7 @@ jobs:
110105
- name: Display Python version
111106
run: python -c "import sys; print(sys.version)"
112107
- name: Create virtual environment
113-
run: tools/ci/create_env.sh
108+
run: tools/ci/create_venv.sh
114109
- name: Build archive
115110
run: |
116111
source tools/ci/build_archive.sh

tools/ci/create_env.sh renamed to tools/ci/create_venv.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
echo Creating isolated virtual environment
44

5+
source tools/ci/env.sh
6+
57
set -eu
68

79
# Required variables

tools/ci/env.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
SETUP_REQUIRES="pip setuptools>=30.3.0 wheel"
2+
3+
# Minimum requirements
4+
REQUIREMENTS="-r requirements.txt"
5+
# Minimum versions of minimum requirements
6+
MIN_REQUIREMENTS="-r min-requirements.txt"
7+
8+
DEFAULT_OPT_DEPENDS="scipy matplotlib pillow pydicom h5py indexed_gzip"
9+
# pydicom has skipped some important pre-releases, so enable a check against master
10+
PYDICOM_MASTER="git+https://github.com/pydicom/pydicom.git@master"
11+
# Minimum versions of optional requirements
12+
MIN_OPT_DEPENDS="matplotlib==1.5.3 pydicom==0.9.9 pillow==2.6"
13+
14+
# Numpy and scipy upload nightly/weekly/intermittent wheels
15+
NIGHTLY_WHEELS="https://pypi.anaconda.org/scipy-wheels-nightly/simple"
16+
STAGING_WHEELS="https://pypi.anaconda.org/multibuild-wheels-staging/simple"
17+
PRE_PIP_FLAGS="--pre --extra-index-url $NIGHTLY_WHEELS --extra-index-url $STAGING_WHEELS"

tools/ci/install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
echo Installing nibabel
44

55
source tools/ci/activate.sh
6+
source tools/ci/env.sh
67

78
set -eu
89

tools/ci/install_dependencies.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
echo Installing dependencies
44

55
source tools/ci/activate.sh
6+
source tools/ci/env.sh
67

78
set -eu
89

910
# Required variables
1011
echo EXTRA_PIP_FLAGS = $EXTRA_PIP_FLAGS
1112
echo DEPENDS = $DEPENDS
13+
echo OPTIONAL_DEPENDS = $OPTIONAL_DEPENDS
1214

1315
set -x
1416

@@ -17,8 +19,12 @@ if [ -n "$EXTRA_PIP_FLAGS" ]; then
1719
fi
1820

1921
if [ -n "$DEPENDS" ]; then
20-
pip install ${EXTRA_PIP_FLAGS} ${!DEPENDS}
21-
pip install ${EXTRA_PIP_FLAGS} $OPTIONAL_DEPENDS || true
22+
pip install ${EXTRA_PIP_FLAGS} --prefer-binary ${!DEPENDS}
23+
if [ -n "$OPTIONAL_DEPENDS" ]; then
24+
for DEP in ${!OPTIONAL_DEPENDS}; do
25+
pip install ${EXTRA_PIP_FLAGS} --prefer-binary $DEP || true
26+
done
27+
fi
2228
fi
2329

2430
set +eux

0 commit comments

Comments
 (0)