Skip to content

Commit aae4283

Browse files
authored
Merge branch 'master' into ci/iwyu
2 parents 139f711 + ce3e312 commit aae4283

File tree

5 files changed

+121
-28
lines changed

5 files changed

+121
-28
lines changed

.appveyor.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ install:
2929
$env:MINICONDA = "C:\Miniconda3-x64"
3030
$env:PATH = "$env:MINICONDA;$env:MINICONDA\Scripts;$env:PATH"
3131
$env:BUILD_SOURCESDIRECTORY = "$env:APPVEYOR_BUILD_FOLDER"
32+
# tell scripts where to put artifacts
33+
# (this variable name is left over from when jobs ran on Azure DevOps)
34+
$env:BUILD_ARTIFACTSTAGINGDIRECTORY = "$env:APPVEYOR_BUILD_FOLDER/artifacts"
3235
3336
build: false
3437

.ci/test-windows.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ $env:TMPDIR = "$env:USERPROFILE\tmp"
1616
Remove-Item $env:TMPDIR -Force -Recurse -ErrorAction Ignore
1717
[Void][System.IO.Directory]::CreateDirectory($env:TMPDIR)
1818

19+
# create the artifact upload directory if it doesn't exist yet
20+
[Void][System.IO.Directory]::CreateDirectory($env:BUILD_ARTIFACTSTAGINGDIRECTORY)
21+
1922
if ($env:TASK -eq "r-package") {
2023
& .\.ci\test-r-package-windows.ps1 ; Assert-Output $?
2124
exit 0
@@ -56,7 +59,7 @@ if ($env:TASK -eq "swig") {
5659
Assert-Output $False
5760
}
5861
cmake --build build --target ALL_BUILD --config Release ; Assert-Output $?
59-
if ($env:AZURE -eq "true") {
62+
if ($env:PRODUCES_ARTIFACTS -eq "true") {
6063
cp ./build/lightgbmlib.jar $env:BUILD_ARTIFACTSTAGINGDIRECTORY/lightgbmlib_win.jar ; Assert-Output $?
6164
}
6265
exit 0

.ci/test.sh

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ if [[ "${TASK}" == "r-package" ]]; then
5050
exit 0
5151
fi
5252

53+
cd "${BUILD_DIRECTORY}"
54+
55+
if [[ $TASK == "swig" ]]; then
56+
cmake -B build -S . -DUSE_SWIG=ON
57+
cmake --build build -j4 || exit 1
58+
if [[ $OS_NAME == "linux" ]] && [[ $COMPILER == "gcc" ]]; then
59+
objdump -T ./lib_lightgbm.so > ./objdump.log || exit 1
60+
objdump -T ./lib_lightgbm_swig.so >> ./objdump.log || exit 1
61+
python ./.ci/check-dynamic-dependencies.py ./objdump.log || exit 1
62+
fi
63+
if [[ $PRODUCES_ARTIFACTS == "true" ]]; then
64+
cp ./build/lightgbmlib.jar "${BUILD_ARTIFACTSTAGINGDIRECTORY}/lightgbmlib_${OS_NAME}.jar"
65+
fi
66+
exit 0
67+
fi
68+
5369
if [[ "$TASK" == "cpp-tests" ]]; then
5470
cmake_args=(
5571
-DBUILD_CPP_TEST=ON
@@ -85,22 +101,6 @@ if [[ $TASK == "if-else" ]]; then
85101
exit 0
86102
fi
87103

88-
cd "${BUILD_DIRECTORY}"
89-
90-
if [[ $TASK == "swig" ]]; then
91-
cmake -B build -S . -DUSE_SWIG=ON
92-
cmake --build build -j4 || exit 1
93-
if [[ $OS_NAME == "linux" ]] && [[ $COMPILER == "gcc" ]]; then
94-
objdump -T ./lib_lightgbm.so > ./objdump.log || exit 1
95-
objdump -T ./lib_lightgbm_swig.so >> ./objdump.log || exit 1
96-
python ./.ci/check-dynamic-dependencies.py ./objdump.log || exit 1
97-
fi
98-
if [[ $PRODUCES_ARTIFACTS == "true" ]]; then
99-
cp ./build/lightgbmlib.jar "${BUILD_ARTIFACTSTAGINGDIRECTORY}/lightgbmlib_${OS_NAME}.jar"
100-
fi
101-
exit 0
102-
fi
103-
104104
if [[ $PYTHON_VERSION == "3.9" ]]; then
105105
CONDA_REQUIREMENT_FILE="${BUILD_DIRECTORY}/.ci/conda-envs/ci-core-py39.txt"
106106
else

.github/workflows/swig.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: SWIG
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
# automatically cancel in-progress builds if another commit is pushed
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
env:
17+
# tell scripts where to put artifacts
18+
# (this variable name is left over from when jobs ran on Azure DevOps)
19+
BUILD_ARTIFACTSTAGINGDIRECTORY: '${{ github.workspace }}/artifacts'
20+
# in CMake-driven builds, parallelize compilation
21+
CMAKE_BUILD_PARALLEL_LEVEL: 4
22+
# all SWIG jobs produce artifacts
23+
PRODUCES_ARTIFACTS: 'true'
24+
# all jobs here have the same 'TASK'
25+
TASK: swig
26+
27+
jobs:
28+
test-swig:
29+
name: swig (${{ matrix.os-display-name || matrix.os }}, ${{ matrix.compiler }})
30+
runs-on: ${{ matrix.os }}
31+
container: ${{ matrix.container }}
32+
timeout-minutes: 60
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
include:
37+
- os: ubuntu-latest
38+
compiler: gcc
39+
container: 'lightgbm.azurecr.io/vsts-agent:manylinux_2_28_x86_64'
40+
artifact-name: swig-linux-x86_64-jar
41+
os-display-name: 'manylinux_2_28'
42+
- os: macos-13
43+
compiler: clang
44+
container: null
45+
artifact-name: swig-macos-x86_64-jar
46+
# Visual Studio 2022
47+
- os: windows-2022
48+
compiler: msvc
49+
container: null
50+
artifact-name: swig-windows-x86_64-jar
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v5
54+
with:
55+
fetch-depth: 5
56+
persist-credentials: false
57+
submodules: true
58+
- name: Setup and run tests on Linux and macOS
59+
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
60+
shell: bash
61+
run: |
62+
export BUILD_DIRECTORY="${GITHUB_WORKSPACE}"
63+
export COMPILER="${{ matrix.compiler }}"
64+
export CONDA="${HOME}/miniforge"
65+
export PATH=${CONDA}/bin:${PATH}
66+
if [[ "${{ matrix.os }}" =~ ^macos ]]; then
67+
export OS_NAME="macos"
68+
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
69+
export OS_NAME="linux"
70+
fi
71+
$GITHUB_WORKSPACE/.ci/setup.sh
72+
$GITHUB_WORKSPACE/.ci/test.sh
73+
- name: Setup and run tests on Windows
74+
if: startsWith(matrix.os, 'windows')
75+
shell: pwsh -command ". {0}"
76+
run: |
77+
$env:BUILD_DIRECTORY = $env:GITHUB_WORKSPACE
78+
$env:BUILD_SOURCESDIRECTORY = $env:BUILD_DIRECTORY
79+
& "$env:GITHUB_WORKSPACE/.ci/test-windows.ps1"
80+
- name: Upload artifacts
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: ${{ matrix.artifact-name }}
84+
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}/*.jar
85+
if-no-files-found: error
86+
all-swig-jobs-successful:
87+
if: always()
88+
runs-on: ubuntu-latest
89+
needs:
90+
- test-swig
91+
steps:
92+
- name: Note that all tests succeeded
93+
uses: re-actors/[email protected]
94+
with:
95+
jobs: ${{ toJSON(needs) }}

.vsts-ci.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ trigger:
88
pr:
99
- master
1010
variables:
11-
AZURE: 'true'
1211
CMAKE_BUILD_PARALLEL_LEVEL: 4
1312
PYTHON_VERSION: '3.13'
1413
runCodesignValidationInjection: false
@@ -110,8 +109,6 @@ jobs:
110109
gpu_source:
111110
TASK: gpu
112111
METHOD: source
113-
swig:
114-
TASK: swig
115112
steps:
116113
- script: |
117114
echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY"
@@ -138,7 +135,7 @@ jobs:
138135
condition: >
139136
and(
140137
succeeded(),
141-
in(variables['TASK'], 'regular', 'sdist', 'bdist', 'swig'),
138+
in(variables['TASK'], 'regular', 'sdist', 'bdist'),
142139
not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))
143140
)
144141
inputs:
@@ -236,15 +233,12 @@ jobs:
236233
PYTHON_VERSION: '3.10'
237234
bdist:
238235
TASK: bdist
239-
swig:
240-
TASK: swig
241236
steps:
242237
- script: |
243238
echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY"
244239
CONDA=$AGENT_HOMEDIRECTORY/miniforge
245240
echo "##vso[task.setvariable variable=CONDA]$CONDA"
246241
echo "##vso[task.prependpath]$CONDA/bin"
247-
echo "##vso[task.setvariable variable=JAVA_HOME]$JAVA_HOME_8_X64"
248242
displayName: 'Set variables'
249243
- script: |
250244
git clean -d -f -x
@@ -263,7 +257,7 @@ jobs:
263257
condition: >
264258
and(
265259
succeeded(),
266-
in(variables['TASK'], 'regular', 'bdist', 'swig'),
260+
in(variables['TASK'], 'regular', 'bdist'),
267261
not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))
268262
)
269263
inputs:
@@ -286,8 +280,6 @@ jobs:
286280
PYTHON_VERSION: '3.10'
287281
bdist:
288282
TASK: bdist
289-
swig:
290-
TASK: swig
291283
steps:
292284
- powershell: |
293285
Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
@@ -311,7 +303,7 @@ jobs:
311303
condition: >
312304
and(
313305
succeeded(),
314-
in(variables['TASK'], 'regular', 'bdist', 'swig'),
306+
in(variables['TASK'], 'regular', 'bdist'),
315307
not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))
316308
)
317309
inputs:

0 commit comments

Comments
 (0)