Skip to content

Commit

Permalink
[ci] further simplify CI configurations (#6463)
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb authored May 28, 2024
1 parent 69b5bd3 commit ceb9986
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 64 deletions.
9 changes: 4 additions & 5 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ version: 4.3.0.99.{build}

image: Visual Studio 2015
platform: x64
configuration: # a trick to construct a build matrix with multiple Python versions
configuration:
- '3.8'

# only build pull requests and
# commits to 'master' or any branch starting with 'release'
# only build on 'master' and pull requests targeting it
branches:
only:
- master
- /^release/

environment:
matrix:
Expand All @@ -25,8 +23,9 @@ install:
- git submodule update --init --recursive # get `external_libs` folder
- set PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH%
- set PYTHON_VERSION=%CONFIGURATION%
- set CONDA_ENV="test-env"
- ps: |
$env:ALLOW_SKIP_ARROW_TESTS = "1"
$env:APPVEYOR = "true"
$env:CMAKE_BUILD_PARALLEL_LEVEL = 4
$env:MINICONDA = "C:\Miniconda3-x64"
$env:PATH = "$env:MINICONDA;$env:MINICONDA\Scripts;$env:PATH"
Expand Down
5 changes: 3 additions & 2 deletions .ci/check_python_dists.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ fi
PY_MINOR_VER=$(python -c "import sys; print(sys.version_info.minor)")
if [ $PY_MINOR_VER -gt 7 ]; then
echo "pydistcheck..."
pip install pydistcheck
pip install 'pydistcheck>=0.7.0'
if { test "${TASK}" = "cuda" || test "${METHOD}" = "wheel"; }; then
pydistcheck \
--inspect \
--ignore 'compiled-objects-have-debug-symbols,distro-too-large-compressed' \
--ignore 'compiled-objects-have-debug-symbols'\
--ignore 'distro-too-large-compressed' \
--max-allowed-size-uncompressed '100M' \
--max-allowed-files 800 \
${DIST_DIR}/* || exit 1
Expand Down
6 changes: 1 addition & 5 deletions .ci/get_workflow_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
from os import environ
from sys import argv, exit
from time import sleep

try:
from urllib import request
except ImportError:
import urllib2 as request
from urllib import request


def get_runs(trigger_phrase):
Expand Down
14 changes: 4 additions & 10 deletions .ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ if [[ $OS_NAME == "macos" ]]; then
if [[ $TASK == "swig" ]]; then
brew install swig
fi
curl \
-sL \
-o miniforge.sh \
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-${ARCH}.sh
else # Linux
if [[ $IN_UBUNTU_BASE_CONTAINER == "true" ]]; then
# fixes error "unable to initialize frontend: Dialog"
Expand Down Expand Up @@ -144,16 +140,14 @@ else # Linux
apt-get install --no-install-recommends -y \
cmake
fi
if [[ $SETUP_CONDA != "false" ]]; then
curl \
-sL \
-o miniforge.sh \
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-${ARCH}.sh
fi
fi

if [[ "${TASK}" != "r-package" ]] && [[ "${TASK}" != "r-rchk" ]]; then
if [[ $SETUP_CONDA != "false" ]]; then
curl \
-sL \
-o miniforge.sh \
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-${ARCH}.sh
sh miniforge.sh -b -p $CONDA
fi
conda config --set always_yes yes --set changeps1 no
Expand Down
1 change: 1 addition & 0 deletions .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -e -E -o -u pipefail

# defaults
CONDA_ENV="test-env"
IN_UBUNTU_BASE_CONTAINER=${IN_UBUNTU_BASE_CONTAINER:-"false"}
METHOD=${METHOD:-""}
PRODUCES_ARTIFACTS=${PRODUCES_ARTIFACTS:-"false"}
Expand Down
7 changes: 6 additions & 1 deletion .ci/test_r_package_valgrind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ bytes_possibly_lost=$(
| tr -d ","
)
echo "valgrind found ${bytes_possibly_lost} bytes possibly lost"
if [[ ${bytes_possibly_lost} -gt 1056 ]]; then
if [[ ${bytes_possibly_lost} -gt 1104 ]]; then
exit 1
fi

# ensure 'grep --count' doesn't cause failures
set +e

echo "checking for invalid reads"
invalid_reads=$(
cat ${VALGRIND_LOGS_FILE} \
| grep --count -i "Invalid read"
Expand All @@ -85,6 +89,7 @@ if [[ ${invalid_reads} -gt 0 ]]; then
exit 1
fi

echo "checking for invalid writes"
invalid_writes=$(
cat ${VALGRIND_LOGS_FILE} \
| grep --count -i "Invalid write"
Expand Down
7 changes: 1 addition & 6 deletions .ci/test_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ function Check-Output {
}
}

$env:CONDA_ENV = "test-env"
$env:LGB_VER = (Get-Content $env:BUILD_SOURCESDIRECTORY\VERSION.txt).trim()

# unify environment variable for Azure DevOps and AppVeyor
if (Test-Path env:APPVEYOR) {
$env:APPVEYOR = "true"
$env:ALLOW_SKIP_ARROW_TESTS = "1"
}

if ($env:TASK -eq "r-package") {
& $env:BUILD_SOURCESDIRECTORY\.ci\test_r_package_windows.ps1 ; Check-Output $?
Exit 0
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
pull_request:
branches:
- master
- release/*
# Run manually by clicking a button in the UI
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -59,16 +58,15 @@ jobs:
run: |
exit 0
test:
name: ${{ matrix.task }} ${{ matrix.cuda_version }} ${{ matrix.method }} (linux, ${{ matrix.compiler }}, Python ${{ matrix.python_version }})
name: ${{ matrix.task }} ${{ matrix.cuda_version }} ${{ matrix.method }} (${{ matrix.linux_version }}, ${{ matrix.compiler }}, Python ${{ matrix.python_version }})
runs-on: [self-hosted, linux]
needs: [restart-docker]
container:
image: ${{ matrix.image }}
image: nvcr.io/nvidia/cuda:${{ matrix.cuda_version }}-devel-${{ matrix.linux_version }}
env:
CMAKE_BUILD_PARALLEL_LEVEL: 4
COMPILER: ${{ matrix.compiler }}
CONDA: /tmp/miniforge
CONDA_ENV: test-env
DEBIAN_FRONTEND: noninteractive
METHOD: ${{ matrix.method }}
OS_NAME: linux
Expand All @@ -84,19 +82,19 @@ jobs:
compiler: gcc
python_version: "3.10"
cuda_version: "11.8.0"
image: nvcr.io/nvidia/cuda:11.8.0-devel-ubuntu20.04
linux_version: "ubuntu20.04"
task: cuda
- method: source
compiler: gcc
python_version: "3.12"
cuda_version: "12.2.0"
image: nvcr.io/nvidia/cuda:12.2.0-devel-ubuntu22.04
linux_version: "ubuntu22.04"
task: cuda
- method: pip
compiler: clang
python_version: "3.11"
cuda_version: "11.8.0"
image: nvcr.io/nvidia/cuda:11.8.0-devel-ubuntu20.04
linux_version: "ubuntu20.04"
task: cuda
steps:
- name: Install latest git
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/linkchecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
- cron: '0 8 * * *'

env:
CONDA_ENV: test-env
OS_NAME: 'linux'
PYTHON_VERSION: '3.12'
TASK: 'check-links'
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/optional_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
pull_request:
branches:
- master
- release/*

jobs:
all-optional-checks-successful:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/python_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
pull_request:
branches:
- master
- release/*

# automatically cancel in-progress builds if another commit is pushed
concurrency:
Expand All @@ -16,7 +15,6 @@ concurrency:

env:
CMAKE_BUILD_PARALLEL_LEVEL: 4
CONDA_ENV: test-env

jobs:
test:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/r_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
pull_request:
branches:
- master
- release/*

# automatically cancel in-progress builds if another commit is pushed
concurrency:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
pull_request:
branches:
- master
- release/*

# automatically cancel in-progress builds if another commit is pushed
concurrency:
Expand All @@ -18,7 +17,6 @@ concurrency:

env:
COMPILER: 'gcc'
CONDA_ENV: test-env
OS_NAME: 'linux'
PYTHON_VERSION: '3.12'

Expand Down
35 changes: 14 additions & 21 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ trigger:
- v*
pr:
- master
- release/*
variables:
AZURE: 'true'
CMAKE_BUILD_PARALLEL_LEVEL: 4
PYTHON_VERSION: '3.12'
CONDA_ENV: test-env
runCodesignValidationInjection: false
skipComponentGovernanceDetection: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
Expand Down Expand Up @@ -187,8 +185,8 @@ jobs:
- job: QEMU_multiarch
###########################################
variables:
BUILD_DIRECTORY: /LightGBM
COMPILER: gcc
OS_NAME: 'linux'
PRODUCES_ARTIFACTS: 'true'
pool:
vmImage: ubuntu-22.04
Expand All @@ -214,25 +212,12 @@ jobs:
git clean -d -f -x
displayName: 'Clean source directory'
- script: |
export ROOT_DOCKER_FOLDER=/LightGBM
cat > docker.env <<EOF
AZURE=$AZURE
OS_NAME=$OS_NAME
COMPILER=$COMPILER
TASK=$TASK
METHOD=$METHOD
CONDA_ENV=$CONDA_ENV
PYTHON_VERSION=$PYTHON_VERSION
BUILD_DIRECTORY=$ROOT_DOCKER_FOLDER
PRODUCES_ARTIFACTS=$PRODUCES_ARTIFACTS
BUILD_ARTIFACTSTAGINGDIRECTORY=$BUILD_ARTIFACTSTAGINGDIRECTORY
EOF
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
$ROOT_DOCKER_FOLDER/.ci/setup.sh || exit 1
$ROOT_DOCKER_FOLDER/.ci/test.sh || exit 1
\$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
Expand All @@ -241,11 +226,19 @@ jobs:
docker run \
--platform "${PLATFORM}" \
--rm \
--env-file docker.env \
-v "$(Build.SourcesDirectory)":"$ROOT_DOCKER_FOLDER" \
--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 $ROOT_DOCKER_FOLDER/docker-script.sh
/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/')))
Expand Down

0 comments on commit ceb9986

Please sign in to comment.