Skip to content

[ci] move more Python jobs to GitHub Actions #199

[ci] move more Python jobs to GitHub Actions

[ci] move more Python jobs to GitHub Actions #199

Workflow file for this run

name: SWIG
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
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'
# in CMake-driven builds, parallelize compilation
CMAKE_BUILD_PARALLEL_LEVEL: 4
# all SWIG jobs produce artifacts
PRODUCES_ARTIFACTS: 'true'
# all jobs here have the same 'TASK'
TASK: swig
jobs:
test-swig:
name: swig (${{ matrix.os-display-name || matrix.os }}, ${{ matrix.compiler }})
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
compiler: gcc
container: 'lightgbm.azurecr.io/vsts-agent:manylinux_2_28_x86_64'
artifact-name: swig-linux-x86_64-jar
os-display-name: 'manylinux_2_28'
- os: macos-15-intel
compiler: clang
container: null
artifact-name: swig-macos-x86_64-jar
# Visual Studio 2022
- os: windows-2022
compiler: msvc
container: null
artifact-name: swig-windows-x86_64-jar
steps:
- name: Checkout repository
uses: actions/checkout@v5
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 BUILD_DIRECTORY="${GITHUB_WORKSPACE}"
export COMPILER="${{ matrix.compiler }}"
export CONDA="${HOME}/miniforge"
export PATH=${CONDA}/bin:${PATH}
if [[ "${{ matrix.os }}" =~ ^macos ]]; then
export OS_NAME="macos"
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
export OS_NAME="linux"
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_DIRECTORY = $env:GITHUB_WORKSPACE
$env:BUILD_SOURCESDIRECTORY = $env:BUILD_DIRECTORY
& "$env:GITHUB_WORKSPACE/.ci/test-windows.ps1"
- name: Upload artifacts
uses: actions/upload-artifact@v5
with:
name: ${{ matrix.artifact-name }}
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}/*.jar
if-no-files-found: error
all-swig-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs:
- test-swig
steps:
- name: Note that all tests succeeded
uses: re-actors/alls-green@v1.2.2
with:
jobs: ${{ toJSON(needs) }}