-
Notifications
You must be signed in to change notification settings - Fork 104
180 lines (163 loc) · 6.78 KB
/
integration-test.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
174
175
176
177
178
179
180
# Do a whole lock, render, and install cycle
name: integration-test
on:
pull_request:
push:
branches:
- main
concurrency:
# Concurrency group that uses the workflow name and PR number if available
# or commit SHA as a fallback. If a new build is triggered under that
# concurrency group while a previous build is running it will be canceled.
# Repeated pushes to a PR will cancel all previous builds, while multiple
# merges to main will not cancel.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
MICROMAMBA_VERSION: 'latest'
defaults:
run:
shell: bash -elx {0}
jobs:
lock-gdal:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.8", "3.12" ]
steps:
- name: Set Conda platform
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
echo "CONDA_PLATFORM=linux-64" >> $GITHUB_ENV
elif [ "$RUNNER_OS" == "macOS" ]; then
echo "CONDA_PLATFORM=osx-arm64" >> $GITHUB_ENV
elif [ "$RUNNER_OS" == "Windows" ]; then
echo "CONDA_PLATFORM=win-64" >> $GITHUB_ENV
fi
- name: Verify Conda platform
run: echo "Conda platform is $CONDA_PLATFORM"
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: install conda-lock
run: |
pip install pipx
pipx install -e .
- name: run-test
run: |
conda-lock --log-level=DEBUG --mamba -f tests/gdal/environment.yml -p $CONDA_PLATFORM
conda-lock render -p $CONDA_PLATFORM
conda-lock render -p $CONDA_PLATFORM --kind=env
cat conda-$CONDA_PLATFORM.lock
cat conda-$CONDA_PLATFORM.lock.yml
cat conda-lock.yml
mkdir lockfiles
mv conda-$CONDA_PLATFORM.lock conda-$CONDA_PLATFORM.lock.yml conda-lock.yml lockfiles
- name: Upload lockfiles
uses: actions/upload-artifact@v4
with:
name: conda-lock-${{ matrix.os }}-${{ matrix.python-version }}
path: lockfiles
install-gdal-with-micromamba:
runs-on: ${{ matrix.os }}
needs: lock-gdal
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.8" ]
steps:
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v2
with:
# # Temporarily pin the version due to
# # <https://github.com/mamba-org/mamba/issues/3467>
# micromamba-version: ${{ env.MICROMAMBA_VERSION }}
micromamba-version: 1.5.10-0
init-shell: bash
- name: Download lockfiles
uses: actions/download-artifact@v4
with:
name: conda-lock-${{ matrix.os }}-${{ matrix.python-version }}
path: lockfiles
- name: Install GDAL with Micromamba
run: |
micromamba create -y -n gdal-test-mm-lock -f lockfiles/conda-lock.yml
micromamba create -y -n gdal-test-mm-explicit -f lockfiles/conda-*.lock
micromamba create -y -n gdal-test-mm-env -f lockfiles/conda-*.lock.yml
micromamba run -n gdal-test-mm-lock gdalinfo --version
micromamba run -n gdal-test-mm-explicit gdalinfo --version
micromamba run -n gdal-test-mm-env gdalinfo --version
micromamba run -n gdal-test-mm-lock python -c 'import toolz; print(toolz.__version__)'
# Micromamba won't install pip dependencies from explicit lockfiles, so skip this test
micromamba run -n gdal-test-mm-env python -c 'import toolz; print(toolz.__version__)'
install-gdal-with-conda-lock:
runs-on: ${{ matrix.os }}
needs: lock-gdal
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.8", "3.12" ]
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
python-version: ${{ matrix.python-version }}
- name: install conda-lock
run: |
pip install pipx
pipx install -e .
- name: Download lockfiles
uses: actions/download-artifact@v4
with:
name: conda-lock-${{ matrix.os }}-${{ matrix.python-version }}
path: lockfiles
- name: Install GDAL with conda-lock
run: |
conda-lock install --log-level=DEBUG -n gdal-test-cl-lock lockfiles/conda-lock.yml
conda-lock install --log-level=DEBUG -n gdal-test-cl-explicit lockfiles/conda-*.lock
conda-lock install --log-level=DEBUG -n gdal-test-cl-env lockfiles/conda-*.lock.yml
conda list -n gdal-test-cl-lock
conda run -n gdal-test-cl-lock gdalinfo --version
conda list -n gdal-test-cl-explicit
conda run -n gdal-test-cl-explicit gdalinfo --version
conda list -n gdal-test-cl-env
conda run -n gdal-test-cl-env gdalinfo --version
conda run -n gdal-test-cl-lock python -c 'import toolz; print(toolz.__version__)'
conda run -n gdal-test-cl-explicit python -c 'import toolz; print(toolz.__version__)'
conda run -n gdal-test-cl-env python -c 'import toolz; print(toolz.__version__)'
install-gdal-with-conda:
runs-on: ${{ matrix.os }}
needs: lock-gdal
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.8" ]
steps:
- uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
python-version: ${{ matrix.python-version }}
- name: Download lockfiles
uses: actions/download-artifact@v4
with:
name: conda-lock-${{ matrix.os }}-${{ matrix.python-version }}
path: lockfiles
- name: Install GDAL with conda
run: |
# conda doesn't recognize the unified lockfile format conda-lock.yml, so skip it.
# conda requires explicit lockfiles have a .txt extension
mv lockfiles/conda-*.lock lockfiles/explicit.txt
conda create -n gdal-test-c-explicit -c conda-forge --file lockfiles/explicit.txt
conda env create -n gdal-test-c-env --file lockfiles/conda-*.lock.yml
conda run -n gdal-test-c-explicit gdalinfo --version
conda run -n gdal-test-c-env gdalinfo --version
# conda doesn't install pip dependencies from explicit lockfiles, so skip this test
conda run -n gdal-test-c-env python -c 'import toolz; print(toolz.__version__)'