Skip to content

Commit 0490fcc

Browse files
authored
Add environment file to GitHub workflows (#2258)
The PR proposes to update GitHub workflows which used miniconda and to install all required conda packages through passing an environment file by single step. It will make the jibs more robust against connectivity issues which occur often during downloading conda packages. There are dedicated yaml files with min set of required packages introduced to reuse them in different jobs/workflows with common requirements. In case when few yaml files needs to be merged into one `environment.yml` there is `conda-merge` tool used.
1 parent e24fa99 commit 0490fcc

14 files changed

+405
-305
lines changed

.github/workflows/build-sphinx.yml

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ jobs:
3636
pull-requests: write
3737

3838
env:
39-
python-ver: '3.12'
40-
CHANNELS: '-c dppy/label/dev -c intel -c conda-forge --override-channels'
41-
NO_INTEL_CHANNELS: '-c dppy/label/dev -c conda-forge --override-channels'
42-
# Install the latest oneAPI compiler to work around an issue
43-
INSTALL_ONE_API: 'yes'
39+
environment-file: 'environments/environment.yml'
40+
build-with-oneapi-env: 'environments/build_with_oneapi.yml'
41+
building-docs-env: 'environments/building_docs.yml'
42+
oneapi-pkgs-env: ''
43+
# Enable env when it's required to use only conda packages without OneAPI installation
44+
# oneapi-pkgs-env: '${{ github.workspace }}/environments/oneapi_pkgs.yml'
4445

4546
steps:
4647
- name: Cancel Previous Runs
@@ -60,6 +61,7 @@ jobs:
6061
docker-images: false
6162

6263
- name: Add Intel repository
64+
if: env.oneapi-pkgs-env == ''
6365
run: |
6466
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
6567
cat GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
@@ -75,6 +77,7 @@ jobs:
7577
sudo apt install --reinstall -y gcc-9 g++-9 libstdc++-9-dev
7678
7779
- name: Install Intel OneAPI
80+
if: env.oneapi-pkgs-env == ''
7881
run: |
7982
sudo apt install hwloc \
8083
intel-oneapi-mkl \
@@ -101,16 +104,25 @@ jobs:
101104
with:
102105
fetch-depth: 0
103106

107+
- name: Install conda-merge tool
108+
uses: BSFishy/pip-action@8f2d471d809dc20b6ada98c91910b6ae6243f318 # v1
109+
with:
110+
packages: conda-merge
111+
112+
- name: Merge conda env files
113+
run: |
114+
conda-merge ${{ env.build-with-oneapi-env }} ${{ env.building-docs-env }} ${{ env.oneapi-pkgs-env }} > ${{ env.environment-file }}
115+
cat ${{ env.environment-file }}
116+
104117
- name: Setup miniconda
105118
id: setup_miniconda
106119
continue-on-error: true
107120
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
108121
with:
109122
miniforge-version: latest
110123
use-mamba: 'true'
111-
channels: conda-forge
112124
conda-remove-defaults: 'true'
113-
python-version: ${{ env.python-ver }}
125+
environment-file: ${{ env.environment-file }}
114126
activate-environment: 'docs'
115127

116128
- name: ReSetup miniconda
@@ -119,35 +131,10 @@ jobs:
119131
with:
120132
miniforge-version: latest
121133
use-mamba: 'true'
122-
channels: conda-forge
123134
conda-remove-defaults: 'true'
124-
python-version: ${{ env.python-ver }}
135+
environment-file: ${{ env.environment-file }}
125136
activate-environment: 'docs'
126137

127-
# Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba
128-
- name: Disable speed limit check in mamba
129-
run: echo "MAMBA_NO_LOW_SPEED_LIMIT=1" >> $GITHUB_ENV
130-
131-
- name: Install sphinx dependencies
132-
run: |
133-
mamba install sphinx sphinx_rtd_theme
134-
pip install sphinxcontrib-googleanalytics==0.4 \
135-
pyenchant sphinxcontrib-spelling
136-
137-
- name: Install dpnp dependencies
138-
if: env.INSTALL_ONE_API == 'yes'
139-
run: |
140-
mamba install numpy dpctl">=0.18.0dev0" cmake cython pytest ninja scikit-build ${{ env.NO_INTEL_CHANNELS }}
141-
142-
- name: Install dpnp dependencies
143-
if: env.INSTALL_ONE_API != 'yes'
144-
run: |
145-
mamba install numpy dpctl">=0.18.0dev0" mkl-devel-dpcpp onedpl-devel tbb-devel dpcpp_linux-64 \
146-
cmake cython pytest ninja scikit-build ${{ env.CHANNELS }}
147-
148-
- name: Install cuPy dependencies
149-
run: mamba install cupy
150-
151138
- name: Conda info
152139
run: mamba info
153140

@@ -178,7 +165,6 @@ jobs:
178165
echo PROJECT_NUMBER=${PROJECT_NUMBER}
179166
echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> $GITHUB_ENV
180167
181-
# https://github.com/marketplace/actions/doxygen-action
182168
- name: Build backend docs
183169
uses: mattnotmitt/doxygen-action@b84fe17600245bb5db3d6c247cc274ea98c15a3b # v1.12
184170
with:
@@ -187,7 +173,6 @@ jobs:
187173
- name: Copy backend docs
188174
run: cp -r dpnp/backend/doc/html ${{ env.PUBLISH_DIR }}/backend_doc
189175

190-
# https://github.com/marketplace/actions/github-pages-action
191176
# The step is only used to build docs while pushing a PR to "master"
192177
- name: Deploy docs
193178
if: env.GH_EVENT_PUSH_UPSTREAM == 'true'

0 commit comments

Comments
 (0)