File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -41,11 +41,35 @@ jobs:
4141 pip install ninja meson scipy
4242 python build_tools/check-meson-openmp-dependencies.py
4343
44+ retrieve-commit-message :
45+ name : Retrieve the latest commit message
46+ runs-on : ubuntu-latest
47+ if : github.repository == 'scikit-learn/scikit-learn'
48+ outputs :
49+ message : ${{ steps.git-log.outputs.message }}
50+ steps :
51+ - uses : actions/checkout@v5
52+ with :
53+ ref : ${{ github.event.pull_request.head.sha }}
54+ - id : git-log
55+ name : Set commit message job output
56+ shell : bash
57+ run : |
58+ set -eu
59+
60+ message=$(git log --format=%B -n 1)
61+
62+ {
63+ echo 'message<<EOF'
64+ echo "${message}"
65+ echo EOF
66+ } >> "${GITHUB_OUTPUT}"
67+
4468 unit-tests :
4569 name : ${{ matrix.name }}
4670 runs-on : ${{ matrix.os }}
4771 if : github.repository == 'scikit-learn/scikit-learn'
48- needs : [lint]
72+ needs : [lint, retrieve-commit-message ]
4973 strategy :
5074 # Ensures that all builds run to completion even if one of them fails
5175 fail-fast : false
88112
89113 - name : Run tests
90114 run : bash -l build_tools/azure/test_script.sh
115+ env :
116+ COMMIT_MESSAGE : ${{ needs.retrieve-commit-message.outputs.message }}
91117
92118 - name : Combine coverage reports from parallel test runners
93119 run : bash -l build_tools/azure/combine_coverage_reports.sh
Original file line number Diff line number Diff line change @@ -22,7 +22,15 @@ if [[ "$BUILD_REASON" == "Schedule" ]]; then
2222 export SKLEARN_RUN_FLOAT32_TESTS=1
2323fi
2424
25- COMMIT_MESSAGE=$( python build_tools/azure/get_commit_message.py --only-show-message)
25+ # In GitHub Action (especially in `.github/workflows/unit-tests.yml` which
26+ # calls this script), the environment variable `COMMIT_MESSAGE` is already set
27+ # to the latest commit message.
28+ if [[ -z " ${COMMIT_MESSAGE+x} " ]]; then
29+ # If 'COMMIT_MESSAGE' is unset we are in Azure, and we retrieve the commit
30+ # message via the get_commit_message.py script which uses Azure-specific
31+ # variables, for example 'BUILD_SOURCEVERSIONMESSAGE'.
32+ COMMIT_MESSAGE=$( python build_tools/azure/get_commit_message.py --only-show-message)
33+ fi
2634
2735if [[ " $COMMIT_MESSAGE " =~ \[ float32\] ]]; then
2836 echo " float32 tests will be run due to commit message"
You can’t perform that action at this time.
0 commit comments