-
Notifications
You must be signed in to change notification settings - Fork 4k
157 lines (152 loc) · 5.14 KB
/
cpp.yml
File metadata and controls
157 lines (152 loc) · 5.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: C++
on:
push:
branches:
- master
pull_request:
branches:
- master
# automatically cancel in-progress builds if another commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
env:
# tell scripts where to put artifacts
# (this variable name is left over from when jobs ran on Azure DevOps)
BUILD_ARTIFACTSTAGINGDIRECTORY: '${{ github.workspace }}/artifacts'
# where repo sources are cloned to
BUILD_DIRECTORY: '${{ github.workspace }}'
# in CMake-driven builds, parallelize compilation
CMAKE_BUILD_PARALLEL_LEVEL: 4
jobs:
test:
name: ${{ matrix.task }} (${{ matrix.os-display-name || matrix.os }}, ${{ matrix.compiler }})
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
timeout-minutes: 60
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
#############
# C++ tests #
#############
- os: ubuntu-latest
task: cpp-tests
compiler: clang-17
method: with-sanitizers
container: 'ubuntu:22.04'
os-display-name: 'ubuntu22.04'
- os: macos-15-intel
task: cpp-tests
compiler: clang
method: with-sanitizers
sanitizers: "address;undefined"
container: null
- os: windows-2022
task: cpp-tests
compiler: msvc
container: null
###########
# if-else #
###########
# These test CLI-generated C++ inference code.
#
# They need Python because they're written with pytest, but they
# do not need the LightGBM Python package
- os: ubuntu-latest
task: if-else
compiler: clang-17
container: 'ubuntu:22.04'
os-display-name: 'ubuntu22.04'
python_version: '3.13'
setup-conda: 'true'
- os: macos-15-intel
task: if-else
compiler: clang
python_version: '3.10'
container: null
- os: ubuntu-latest
task: if-else
compiler: gcc
python_version: '3.11'
container: 'ghcr.io/lightgbm-org/lightgbm-vsts-agent:manylinux_2_28_x86_64'
os-display-name: 'manylinux_2_28'
steps:
- name: Install packages used by third-party actions
if: matrix.container == 'ubuntu:22.04'
shell: bash
run: |
apt-get update -y
apt-get install --no-install-recommends -y \
dirmngr \
gpg \
gpg-agent \
software-properties-common \
sudo
# install newest version of git
# ref:
# - https://unix.stackexchange.com/a/170831/550004
# - https://git-scm.com/download/linux
add-apt-repository ppa:git-core/ppa -y
apt-get update -y
apt-get install --no-install-recommends -y \
git
- name: Trust git cloning LightGBM
if: startsWith(matrix.os, 'ubuntu')
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Setup and run tests on Linux and macOS
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
export COMPILER="${{ matrix.compiler }}"
export CONDA="${HOME}/miniforge"
export METHOD="${{ matrix.method }}"
export PATH=${CONDA}/bin:${PATH}
export PYTHON_VERSION="${{ matrix.python_version }}"
export SANITIZERS="${{ matrix.sanitizers }}"
export SETUP_CONDA="${{ matrix.setup-conda }}"
export TASK="${{ matrix.task }}"
if [[ "${{ matrix.os }}" =~ ^macos ]]; then
export OS_NAME="macos"
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
export OS_NAME="linux"
fi
if [[ "${{ matrix.container }}" == "ubuntu:22.04" ]]; then
export DEBIAN_FRONTEND=noninteractive
export IN_UBUNTU_BASE_CONTAINER="true"
fi
$GITHUB_WORKSPACE/.ci/setup.sh
$GITHUB_WORKSPACE/.ci/test.sh
- name: Setup and run tests on Windows
if: startsWith(matrix.os, 'windows')
shell: pwsh -command ". {0}"
run: |
$env:BUILD_SOURCESDIRECTORY = $env:BUILD_DIRECTORY
$env:TASK = "${{ matrix.task }}"
& "$env:GITHUB_WORKSPACE/.ci/test-windows.ps1"
all-cpp-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs:
- test
permissions:
statuses: read
steps:
- name: Note that all tests succeeded
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}