Skip to content

Commit

Permalink
[ci] [python-package] Add CI job testing compatibility with oldest po…
Browse files Browse the repository at this point in the history
…ssible versions (#5936)
  • Loading branch information
jameslamb authored Jul 6, 2023
1 parent 32bd71e commit d9c7c72
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .ci/test-python-oldest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# oldest versions of dependencies published after
# minimum supported Python version's first release
#
# see https://devguide.python.org/versions/
#
echo "installing lightgbm's dependencies"
pip install \
'numpy==1.12.0' \
'pandas==0.24.0' \
'scikit-learn==0.18.2' \
'scipy==0.19.0' \
|| exit -1
echo "done installing lightgbm's dependencies"

echo "installing lightgbm"
pip install --no-deps dist/*.whl || exit -1
echo "done installing lightgbm"

echo "installed package versions:"
pip freeze

echo ""
echo "checking that examples run without error"

# run a few examples to test that Python package minimally works
echo ""
echo "--- advanced_example.py ---"
echo ""
python ./examples/python-guide/advanced_example.py || exit -1

echo ""
echo "--- logistic_regression.py ---"
echo ""
python ./examples/python-guide/logistic_regression.py || exit -1

echo ""
echo "--- simple_example.py ---"
echo ""
python ./examples/python-guide/simple_example.py || exit -1

echo ""
echo "--- sklearn_example.py ---"
echo ""
python ./examples/python-guide/sklearn_example.py || exit -1

echo ""
echo "done testing on oldest supported Python version"
28 changes: 27 additions & 1 deletion .github/workflows/python_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,36 @@ jobs:
export PATH=${CONDA}/bin:${PATH}
$GITHUB_WORKSPACE/.ci/setup.sh || exit -1
$GITHUB_WORKSPACE/.ci/test.sh || exit -1
test-oldest-versions:
name: Python - oldest supported versions (ubuntu-latest)
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 5
submodules: true
- name: Create wheel
run: |
docker run \
--rm \
-v $(pwd):/opt/lgb-build \
-w /opt/lgb-build \
lightgbm/vsts-agent:manylinux_2_28_x86_64 \
/bin/bash -c 'PATH=/opt/miniforge/bin:$PATH sh ./build-python.sh bdist_wheel --nomp'
- name: Test compatibility
run: |
docker run \
--rm \
-v $(pwd):/opt/lgb-build \
-w /opt/lgb-build \
python:3.6 \
/bin/bash ./.ci/test-python-oldest.sh
all-python-package-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs: [test]
needs: [test, test-oldest-versions]
steps:
- name: Note that all tests succeeded
uses: re-actors/[email protected]
Expand Down

0 comments on commit d9c7c72

Please sign in to comment.