Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] build aarch64 wheel builds on a real aarch64 machine #6843

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
remove emulation job
  • Loading branch information
jameslamb committed Feb 28, 2025
commit 01acab3f31ad7fdbb8f6f8f807f7d0592824bd23
260 changes: 130 additions & 130 deletions .github/workflows/python_package.yml
Original file line number Diff line number Diff line change
@@ -65,141 +65,141 @@ jobs:
with:
name: linux-aarch64-wheel
path: artifacts/*.whl
# test-macos:
# name: ${{ matrix.task }} ${{ matrix.method }} (${{ matrix.os }}, Python ${{ matrix.python_version }})
# runs-on: ${{ matrix.os }}
# timeout-minutes: 60
# strategy:
# fail-fast: false
# matrix:
# include:
# - os: macos-13
# task: regular
# python_version: '3.11'
# - os: macos-13
# task: sdist
# python_version: '3.12'
# - os: macos-13
# task: bdist
# python_version: '3.9'
# - os: macos-13
# task: if-else
# python_version: '3.10'
# - os: macos-14
# task: bdist
# method: wheel
# python_version: '3.11'
# - os: macos-13
# task: mpi
# method: source
# python_version: '3.12'
# - os: macos-13
# task: mpi
# method: pip
# python_version: '3.13'
# - os: macos-13
# task: mpi
# method: wheel
# python_version: '3.10'
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# fetch-depth: 5
# submodules: true
# - name: Setup and run tests
# shell: bash
# run: |
# export TASK="${{ matrix.task }}"
# export METHOD="${{ matrix.method }}"
# export OS_NAME="macos"
# export PYTHON_VERSION="${{ matrix.python_version }}"
# if [[ "${{ matrix.os }}" == "macos-14" ]]; then
# # use clang when creating macOS release artifacts
# export COMPILER="clang"
# else
# export COMPILER="gcc"
# fi
# export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
# export CONDA=${HOME}/miniforge
# export PATH=${CONDA}/bin:${PATH}
# $GITHUB_WORKSPACE/.ci/setup.sh || exit 1
# $GITHUB_WORKSPACE/.ci/test.sh || exit 1
# - name: upload wheels
# if: ${{ matrix.method == 'wheel' && matrix.os == 'macos-14' }}
# uses: actions/upload-artifact@v4
# with:
# name: macosx-arm64-wheel
# path: dist/*.whl
# test-latest-versions:
# name: Python - latest versions (ubuntu-latest)
# runs-on: ubuntu-latest
# timeout-minutes: 60
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# fetch-depth: 5
# submodules: true
# - name: Create wheel
# run: |
# docker run \
# --rm \
# --env CMAKE_BUILD_PARALLEL_LEVEL=${{ env.CMAKE_BUILD_PARALLEL_LEVEL }} \
# -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.13 \
# /bin/bash ./.ci/test-python-latest.sh
# test-old-versions:
# name: Python - oldest supported versions (ubuntu-latest)
# runs-on: ubuntu-latest
# timeout-minutes: 60
# strategy:
# fail-fast: false
# matrix:
# # end-of-life Python versions
# python_version:
# - '3.7'
# - '3.8'
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# fetch-depth: 5
# submodules: true
# - name: Create wheel
# run: |
# docker run \
# --rm \
# --env CMAKE_BUILD_PARALLEL_LEVEL=${{ env.CMAKE_BUILD_PARALLEL_LEVEL }} \
# -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:${{ matrix.python_version }} \
# /bin/bash ./.ci/test-python-oldest.sh
test-macos:
name: ${{ matrix.task }} ${{ matrix.method }} (${{ matrix.os }}, Python ${{ matrix.python_version }})
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: macos-13
task: regular
python_version: '3.11'
- os: macos-13
task: sdist
python_version: '3.12'
- os: macos-13
task: bdist
python_version: '3.9'
- os: macos-13
task: if-else
python_version: '3.10'
- os: macos-14
task: bdist
method: wheel
python_version: '3.11'
- os: macos-13
task: mpi
method: source
python_version: '3.12'
- os: macos-13
task: mpi
method: pip
python_version: '3.13'
- os: macos-13
task: mpi
method: wheel
python_version: '3.10'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: true
- name: Setup and run tests
shell: bash
run: |
export TASK="${{ matrix.task }}"
export METHOD="${{ matrix.method }}"
export OS_NAME="macos"
export PYTHON_VERSION="${{ matrix.python_version }}"
if [[ "${{ matrix.os }}" == "macos-14" ]]; then
# use clang when creating macOS release artifacts
export COMPILER="clang"
else
export COMPILER="gcc"
fi
export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
export CONDA=${HOME}/miniforge
export PATH=${CONDA}/bin:${PATH}
$GITHUB_WORKSPACE/.ci/setup.sh || exit 1
$GITHUB_WORKSPACE/.ci/test.sh || exit 1
- name: upload wheels
if: ${{ matrix.method == 'wheel' && matrix.os == 'macos-14' }}
uses: actions/upload-artifact@v4
with:
name: macosx-arm64-wheel
path: dist/*.whl
test-latest-versions:
name: Python - latest versions (ubuntu-latest)
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: true
- name: Create wheel
run: |
docker run \
--rm \
--env CMAKE_BUILD_PARALLEL_LEVEL=${{ env.CMAKE_BUILD_PARALLEL_LEVEL }} \
-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.13 \
/bin/bash ./.ci/test-python-latest.sh
test-old-versions:
name: Python - oldest supported versions (ubuntu-latest)
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
# end-of-life Python versions
python_version:
- '3.7'
- '3.8'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: true
- name: Create wheel
run: |
docker run \
--rm \
--env CMAKE_BUILD_PARALLEL_LEVEL=${{ env.CMAKE_BUILD_PARALLEL_LEVEL }} \
-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:${{ matrix.python_version }} \
/bin/bash ./.ci/test-python-oldest.sh
all-python-package-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs:
# - test-latest-versions
# - test-macos
- test-latest-versions
- test-macos
- test-linux-aarch64
# - test-old-versions
- test-old-versions
steps:
- name: Note that all tests succeeded
uses: re-actors/alls-green@v1.2.2
72 changes: 0 additions & 72 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
@@ -223,77 +223,6 @@ jobs:
inputs:
filePath: $(Build.SourcesDirectory)/.ci/test.sh
targetType: 'filePath'
##################
# QEMU_multiarch #
##################
- job: QEMU_multiarch
variables:
BUILD_DIRECTORY: /LightGBM
COMPILER: gcc
PRODUCES_ARTIFACTS: 'true'
pool:
vmImage: ubuntu-22.04
timeoutInMinutes: 180
strategy:
matrix:
bdist:
TASK: bdist
ARCH: aarch64
steps:
- script: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y \
binfmt-support \
qemu \
qemu-user \
qemu-user-static
displayName: 'Install QEMU'
- script: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
displayName: 'Enable Docker multi-architecture support'
- script: |
git clean -d -f -x
displayName: 'Clean source directory'
- script: |
cat > docker-script.sh <<EOF
export CONDA=\$HOME/miniforge
export PATH=\$CONDA/bin:/opt/rh/llvm-toolset-7.0/root/usr/bin:\$PATH
export LD_LIBRARY_PATH=/opt/rh/llvm-toolset-7.0/root/usr/lib64:\$LD_LIBRARY_PATH
Comment on lines -263 to -264
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally did not preserve this in the workflow. It shouldn't be necessary.

docker run \
  --rm \
  -it lightgbm/vsts-agent:manylinux2014_aarch64 \
  bash

echo $PATH
# /opt/rh/llvm-toolset-7.0/root/usr/bin:/opt/rh/devtoolset-10/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bi

echo $LD_LIBRARY_PATH
# /opt/rh/llvm-toolset-7.0/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib:/opt/rh/devtoolset-10/root/usr/lib64/dyninst:/opt/rh/devtoolset-10/root/usr/lib/dyninst:/usr/local/lib64

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see that the correct compiler (gcc) is being used:

-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/rh/devtoolset-10/root/usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/rh/devtoolset-10/root/usr/bin/g++ - skipped

(build link)

\$BUILD_DIRECTORY/.ci/setup.sh || exit 1
\$BUILD_DIRECTORY/.ci/test.sh || exit 1
EOF
IMAGE_URI="lightgbm/vsts-agent:manylinux2014_aarch64"
docker pull "${IMAGE_URI}" || exit 1
PLATFORM=$(docker inspect --format='{{.Os}}/{{.Architecture}}' "${IMAGE_URI}") || exit 1
echo "detected image platform: ${PLATFORM}"
docker run \
--platform "${PLATFORM}" \
--rm \
--env AZURE=true \
--env BUILD_ARTIFACTSTAGINGDIRECTORY=$BUILD_ARTIFACTSTAGINGDIRECTORY \
--env BUILD_DIRECTORY=$BUILD_DIRECTORY \
--env COMPILER=$COMPILER \
--env METHOD=$METHOD \
--env OS_NAME=linux \
--env PRODUCES_ARTIFACTS=$PRODUCES_ARTIFACTS \
--env PYTHON_VERSION=$PYTHON_VERSION \
--env TASK=$TASK \
-v "$(Build.SourcesDirectory)":"$BUILD_DIRECTORY" \
-v "$(Build.ArtifactStagingDirectory)":"$(Build.ArtifactStagingDirectory)" \
"${IMAGE_URI}" \
/bin/bash $BUILD_DIRECTORY/docker-script.sh
displayName: 'Setup and run tests'
- task: PublishBuildArtifacts@1
condition: >
and(
succeeded(),
in(variables['TASK'], 'bdist'),
not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))
)
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: PackageAssets
artifactType: container
#########
# macOS #
#########
@@ -437,7 +366,6 @@ jobs:
dependsOn:
- Linux
- Linux_latest
- QEMU_multiarch
- macOS
- Windows
- R_artifact
Loading
Oops, something went wrong.