Skip to content

Commit 58bc225

Browse files
authored
[backport] [CI] Fix github action mismatched glibcxx. (dmlc#8551) (dmlc#8552)
Split up the Linux test to use the toolchain from conda forge.
1 parent 850b531 commit 58bc225

File tree

4 files changed

+100
-46
lines changed

4 files changed

+100
-46
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,18 @@ jobs:
7575
- uses: actions/checkout@v2
7676
with:
7777
submodules: 'true'
78-
- name: Install system packages
79-
run: |
80-
sudo apt-get install -y --no-install-recommends ninja-build
81-
- uses: conda-incubator/setup-miniconda@v2
78+
- uses: mamba-org/provision-with-micromamba@f347426e5745fe3dfc13ec5baf20496990d0281f # v14
8279
with:
83-
auto-update-conda: true
84-
python-version: ${{ matrix.python-version }}
85-
activate-environment: test
80+
cache-downloads: true
81+
cache-env: true
82+
environment-name: cpp_test
83+
environment-file: tests/ci_build/conda_env/cpp_test.yml
8684
- name: Display Conda env
8785
shell: bash -l {0}
8886
run: |
8987
conda info
9088
conda list
89+
9190
- name: Build and install XGBoost static library
9291
shell: bash -l {0}
9392
run: |
@@ -109,6 +108,7 @@ jobs:
109108
cd ..
110109
rm -rf ./build
111110
popd
111+
112112
- name: Build and install XGBoost shared library
113113
shell: bash -l {0}
114114
run: |

.github/workflows/python_tests.yml

Lines changed: 69 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,46 @@ jobs:
4141
run: |
4242
python tests/ci_build/lint_python.py --format=0 --type-check=0 --pylint=1
4343
44+
python-sdist-test-on-Linux:
45+
# Mismatched glibcxx version between system and conda forge.
46+
runs-on: ${{ matrix.os }}
47+
name: Test installing XGBoost Python source package on ${{ matrix.os }}
48+
strategy:
49+
matrix:
50+
os: [ubuntu-latest]
51+
steps:
52+
- uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0
53+
with:
54+
submodules: 'true'
55+
- uses: mamba-org/provision-with-micromamba@f347426e5745fe3dfc13ec5baf20496990d0281f # v14
56+
with:
57+
cache-downloads: true
58+
cache-env: false
59+
environment-name: sdist_test
60+
environment-file: tests/ci_build/conda_env/sdist_test.yml
61+
- name: Display Conda env
62+
shell: bash -l {0}
63+
run: |
64+
conda info
65+
conda list
66+
- name: Build and install XGBoost
67+
shell: bash -l {0}
68+
run: |
69+
cd python-package
70+
python --version
71+
python setup.py sdist
72+
pip install -v ./dist/xgboost-*.tar.gz
73+
cd ..
74+
python -c 'import xgboost'
75+
4476
python-sdist-test:
77+
# Use system toolchain instead of conda toolchain for macos and windows.
78+
# MacOS has linker error if clang++ from conda-forge is used
4579
runs-on: ${{ matrix.os }}
4680
name: Test installing XGBoost Python source package on ${{ matrix.os }}
4781
strategy:
4882
matrix:
49-
os: [ubuntu-latest, macos-11, windows-latest]
83+
os: [macos-11, windows-latest]
5084
python-version: ["3.8"]
5185
steps:
5286
- uses: actions/checkout@v2
@@ -56,11 +90,7 @@ jobs:
5690
if: matrix.os == 'macos-11'
5791
run: |
5892
brew install ninja libomp
59-
- name: Install Ubuntu system dependencies
60-
if: matrix.os == 'ubuntu-latest'
61-
run: |
62-
sudo apt-get install -y --no-install-recommends ninja-build
63-
- uses: conda-incubator/setup-miniconda@v2
93+
- uses: conda-incubator/setup-miniconda@35d1405e78aa3f784fe3ce9a2eb378d5eeb62169 # v2.1.1
6494
with:
6595
auto-update-conda: true
6696
python-version: ${{ matrix.python-version }}
@@ -80,61 +110,65 @@ jobs:
80110
cd ..
81111
python -c 'import xgboost'
82112
83-
python-tests-on-win:
113+
python-tests-on-macos:
84114
name: Test XGBoost Python package on ${{ matrix.config.os }}
85115
runs-on: ${{ matrix.config.os }}
116+
timeout-minutes: 60
86117
strategy:
87118
matrix:
88119
config:
89-
- {os: windows-latest, python-version: '3.8'}
120+
- {os: macos-11}
90121

91122
steps:
92-
- uses: actions/checkout@v2
123+
- uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0
93124
with:
94125
submodules: 'true'
95126

96-
- uses: conda-incubator/setup-miniconda@v2
127+
- uses: mamba-org/provision-with-micromamba@f347426e5745fe3dfc13ec5baf20496990d0281f # v14
97128
with:
98-
auto-update-conda: true
99-
python-version: ${{ matrix.config.python-version }}
100-
activate-environment: win64_env
101-
environment-file: tests/ci_build/conda_env/win64_cpu_test.yml
129+
cache-downloads: true
130+
cache-env: false
131+
environment-name: macos_test
132+
environment-file: tests/ci_build/conda_env/macos_cpu_test.yml
102133

103134
- name: Display Conda env
104135
shell: bash -l {0}
105136
run: |
106137
conda info
107138
conda list
108139
109-
- name: Build XGBoost on Windows
140+
- name: Build XGBoost on macos
110141
shell: bash -l {0}
111142
run: |
112-
mkdir build_msvc
113-
cd build_msvc
114-
cmake .. -G"Visual Studio 17 2022" -DCMAKE_CONFIGURATION_TYPES="Release" -A x64 -DGOOGLE_TEST=ON -DUSE_DMLC_GTEST=ON
115-
cmake --build . --config Release --parallel $(nproc)
143+
brew install ninja
144+
145+
mkdir build
146+
cd build
147+
# Set prefix, to use OpenMP library from Conda env
148+
# See https://github.com/dmlc/xgboost/issues/7039#issuecomment-1025038228
149+
# to learn why we don't use libomp from Homebrew.
150+
cmake .. -GNinja -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
151+
ninja
116152
117153
- name: Install Python package
118154
shell: bash -l {0}
119155
run: |
120156
cd python-package
121157
python --version
122-
python setup.py bdist_wheel --universal
123-
pip install ./dist/*.whl
158+
python setup.py install
124159
125160
- name: Test Python package
126161
shell: bash -l {0}
127162
run: |
128-
pytest -s -v ./tests/python
163+
pytest -s -v -rxXs --durations=0 ./tests/python
129164
130-
python-tests-on-macos:
165+
python-tests-on-win:
131166
name: Test XGBoost Python package on ${{ matrix.config.os }}
132167
runs-on: ${{ matrix.config.os }}
133-
timeout-minutes: 90
134168
strategy:
135169
matrix:
136170
config:
137-
- {os: macos-11, python-version "3.8" }
171+
- {os: windows-latest, python-version: '3.8'}
138172

139173
steps:
140174
- uses: actions/checkout@v2
@@ -145,36 +179,32 @@ jobs:
145179
with:
146180
auto-update-conda: true
147181
python-version: ${{ matrix.config.python-version }}
148-
activate-environment: macos_test
149-
environment-file: tests/ci_build/conda_env/macos_cpu_test.yml
182+
activate-environment: win64_env
183+
environment-file: tests/ci_build/conda_env/win64_cpu_test.yml
150184

151185
- name: Display Conda env
152186
shell: bash -l {0}
153187
run: |
154188
conda info
155189
conda list
156190
157-
- name: Build XGBoost on macos
191+
- name: Build XGBoost on Windows
158192
shell: bash -l {0}
159193
run: |
160-
brew install ninja
161-
162-
mkdir build
163-
cd build
164-
# Set prefix, to use OpenMP library from Conda env
165-
# See https://github.com/dmlc/xgboost/issues/7039#issuecomment-1025038228
166-
# to learn why we don't use libomp from Homebrew.
167-
cmake .. -GNinja -DGOOGLE_TEST=ON -DUSE_DMLC_GTEST=ON -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
168-
ninja
194+
mkdir build_msvc
195+
cd build_msvc
196+
cmake .. -G"Visual Studio 17 2022" -DCMAKE_CONFIGURATION_TYPES="Release" -A x64 -DGOOGLE_TEST=ON -DUSE_DMLC_GTEST=ON
197+
cmake --build . --config Release --parallel $(nproc)
169198
170199
- name: Install Python package
171200
shell: bash -l {0}
172201
run: |
173202
cd python-package
174203
python --version
175-
python setup.py install
204+
python setup.py bdist_wheel --universal
205+
pip install ./dist/*.whl
176206
177207
- name: Test Python package
178208
shell: bash -l {0}
179209
run: |
180-
pytest -s -v ./tests/python
210+
pytest -s -v -rxXs --durations=0 ./tests/python

tests/ci_build/conda_env/cpp_test.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# conda environment for CPP test on Linux distributions
2+
name: cpp_test
3+
channels:
4+
- defaults
5+
- conda-forge
6+
dependencies:
7+
- cmake
8+
- ninja
9+
- c-compiler
10+
- cxx-compiler
11+
- gtest
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# conda environment for source distribution test.
2+
name: sdist_test
3+
channels:
4+
- defaults
5+
- conda-forge
6+
dependencies:
7+
- python=3.8
8+
- pip
9+
- wheel
10+
- cmake
11+
- ninja
12+
- c-compiler
13+
- cxx-compiler

0 commit comments

Comments
 (0)