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] Upgrade github workflows to use latest Conda setup action #10320

Merged
merged 9 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions .github/workflows/jvm_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,20 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-11]
os: [windows-latest, ubuntu-latest, macos-13]

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: 'true'

- uses: mamba-org/setup-micromamba@422500192359a097648154e8db4e39bdb6c6eed7 # v1.8.1
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
micromamba-version: '1.5.6-0'
environment-name: jvm_tests
create-args: >-
python=3.10
awscli
cache-downloads: true
cache-environment: true
init-shell: bash powershell
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: jvm_tests
environment-file: tests/ci_build/conda_env/jvm_tests.yml
use-mamba: true

- name: Cache Maven packages
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
Expand Down Expand Up @@ -61,7 +58,7 @@ jobs:
id: extract_branch
if: |
(github.ref == 'refs/heads/master' || contains(github.ref, 'refs/heads/release_')) &&
(matrix.os == 'windows-latest' || matrix.os == 'macos-11')
(matrix.os == 'windows-latest' || matrix.os == 'macos-13')

- name: Publish artifact xgboost4j.dll to S3
run: |
Expand All @@ -85,7 +82,7 @@ jobs:
python -m awscli s3 cp libxgboost4j_${{ github.sha }}.dylib s3://xgboost-nightly-builds/${{ steps.extract_branch.outputs.branch }}/libxgboost4j/ --acl public-read --region us-west-2
if: |
(github.ref == 'refs/heads/master' || contains(github.ref, 'refs/heads/release_')) &&
matrix.os == 'macos-11'
matrix.os == 'macos-13'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_IAM_S3_UPLOADER }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_IAM_S3_UPLOADER }}
Expand Down
23 changes: 12 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-11]
os: [macos-12]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
Expand All @@ -33,7 +33,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DGOOGLE_TEST=ON -DUSE_OPENMP=ON -DUSE_DMLC_GTEST=ON -GNinja -DBUILD_DEPRECATED_CLI=ON
cmake .. -DGOOGLE_TEST=ON -DUSE_OPENMP=ON -DUSE_DMLC_GTEST=ON -GNinja -DBUILD_DEPRECATED_CLI=ON -DUSE_SANITIZER=ON -DENABLED_SANITIZERS=address -DCMAKE_BUILD_TYPE=RelWithDebInfo
ninja -v
- name: Run gtest binary
run: |
Expand Down Expand Up @@ -79,13 +79,13 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@3c96c0c27676490c63c18bc81f5c51895ac3e0e6 # v16
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
cache-downloads: true
cache-env: true
environment-name: linux_sycl_test
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: linux_sycl_test
environment-file: tests/ci_build/conda_env/linux_sycl_test.yml

use-mamba: true
- name: Display Conda env
run: |
conda info
Expand Down Expand Up @@ -121,12 +121,13 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@3c96c0c27676490c63c18bc81f5c51895ac3e0e6 # v16
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
cache-downloads: true
cache-env: true
environment-name: cpp_test
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: cpp_test
environment-file: tests/ci_build/conda_env/cpp_test.yml
use-mamba: true
- name: Display Conda env
run: |
conda info
Expand Down
51 changes: 28 additions & 23 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@3c96c0c27676490c63c18bc81f5c51895ac3e0e6 # v16
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
cache-downloads: true
cache-env: true
environment-name: python_lint
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: python_lint
environment-file: tests/ci_build/conda_env/python_lint.yml
use-mamba: true
- name: Display Conda env
run: |
conda info
Expand All @@ -55,12 +56,13 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@3c96c0c27676490c63c18bc81f5c51895ac3e0e6 # v16
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
cache-downloads: true
cache-env: true
environment-name: sdist_test
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: sdist_test
environment-file: tests/ci_build/conda_env/sdist_test.yml
use-mamba: true
- name: Display Conda env
run: |
conda info
Expand All @@ -81,14 +83,14 @@ jobs:
name: Test installing XGBoost Python source package on ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, windows-latest]
os: [macos-13, windows-latest]
python-version: ["3.8"]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: 'true'
- name: Install osx system dependencies
if: matrix.os == 'macos-11'
if: matrix.os == 'macos-13'
run: |
brew install ninja libomp
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
Expand Down Expand Up @@ -119,19 +121,20 @@ jobs:
strategy:
matrix:
config:
- {os: macos-11}
- {os: macos-13}

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: 'true'

- uses: mamba-org/provision-with-micromamba@3c96c0c27676490c63c18bc81f5c51895ac3e0e6 # v16
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
cache-downloads: true
cache-env: true
environment-name: macos_test
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: macos_cpu_test
environment-file: tests/ci_build/conda_env/macos_cpu_test.yml
use-mamba: true

- name: Display Conda env
run: |
Expand Down Expand Up @@ -222,12 +225,13 @@ jobs:
with:
submodules: 'true'

- uses: mamba-org/provision-with-micromamba@3c96c0c27676490c63c18bc81f5c51895ac3e0e6 # v16
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
cache-downloads: true
cache-env: true
environment-name: linux_cpu_test
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: linux_cpu_test
environment-file: tests/ci_build/conda_env/linux_cpu_test.yml
use-mamba: true

- name: Display Conda env
run: |
Expand Down Expand Up @@ -274,12 +278,13 @@ jobs:
with:
submodules: 'true'

- uses: mamba-org/provision-with-micromamba@3c96c0c27676490c63c18bc81f5c51895ac3e0e6 # v16
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
cache-downloads: true
cache-env: true
environment-name: linux_sycl_test
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: linux_sycl_test
environment-file: tests/ci_build/conda_env/linux_sycl_test.yml
use-mamba: true

- name: Display Conda env
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: 'true'
- uses: conda-incubator/setup-miniconda@v3.0.4
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
miniforge-variant: Mambaforge
miniforge-version: latest
Expand Down
56 changes: 44 additions & 12 deletions src/collective/tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <algorithm> // for sort
#include <chrono> // for seconds, ms
#include <cstdint> // for int32_t
#include <memory> // for unique_ptr
#include <string> // for string
#include <utility> // for move, forward

Expand Down Expand Up @@ -376,20 +377,51 @@ Result RabitTracker::Bootstrap(std::vector<WorkerProxy>* p_workers) {
if (!rc.OK()) {
return rc;
}
auto host = gethostbyname(out->c_str());

// get ip address from host
std::string ip;
rc = INetNToP(host, &ip);
if (!rc.OK()) {
return rc;
addrinfo hints;
addrinfo* servinfo;

std::memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE;

std::int32_t errc{0};
std::unique_ptr<addrinfo*, std::function<void(addrinfo**)>> guard{&servinfo, [](addrinfo** ptr) {
freeaddrinfo(*ptr);
}};
if ((errc = getaddrinfo(nullptr, "0", &hints, &servinfo)) != 0) {
return Fail("Failed to get address info:" + std::string{gai_strerror(errc)});
}

if (!(ip.size() >= 4 && ip.substr(0, 4) == "127.")) {
// return if this is a public IP address.
// not entirely accurate, we have other reserved IPs
*out = ip;
return Success();
// https://beej.us/guide/bgnet/html/#getaddrinfoprepare-to-launch
std::vector<SockAddress> addresses;
for (addrinfo* p = servinfo; p != nullptr; p = p->ai_next) {
// Get the pointer to the address itself, different fields in IPv4 and IPv6:
if (p->ai_family == AF_INET) { // IPv4
struct sockaddr_in* ipv4 = reinterpret_cast<sockaddr_in*>(p->ai_addr);
addresses.emplace_back(SockAddrV4{*ipv4});
auto ip = addresses.back().V4().Addr();
// Priortize V4.
// Return if this is a public IP address. Not accurate, we have other reserved IPs
if (ip.size() > 4 && ip.substr(0, 4) != "127." && ip != SockAddrV4::InaddrAny().Addr()) {
*out = ip;
return Success();
}
} else {
struct sockaddr_in6* ipv6 = reinterpret_cast<sockaddr_in6*>(p->ai_addr);
addresses.emplace_back(SockAddrV6{*ipv6});
}
}
// If not v4 address is found, we try v6
for (auto const& addr : addresses) {
if (addr.IsV6()) {
auto ip = addr.V6().Addr();
if (ip != SockAddrV6::InaddrAny().Addr() && ip != SockAddrV6::Loopback().Addr()) {
*out = ip;
return Success();
}
}
}

// Create an UDP socket to prob the public IP address, it's fine even if it's
Expand All @@ -413,7 +445,7 @@ Result RabitTracker::Bootstrap(std::vector<WorkerProxy>* p_workers) {
if (getsockname(sock, reinterpret_cast<struct sockaddr*>(&addr), &len) == -1) {
return Fail("Failed to get sock name.");
}
ip = inet_ntoa(addr.sin_addr);
std::string ip = inet_ntoa(addr.sin_addr);

err = system::CloseSocket(sock);
if (err != 0) {
Expand Down
6 changes: 6 additions & 0 deletions tests/ci_build/conda_env/jvm_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: jvm_tests
channels:
- conda-forge
dependencies:
- python=3.10
- awscli
Loading