Skip to content

Commit accd654

Browse files
c-p-i-ofacebook-github-bot
authored andcommitted
add a github workflow for re-enabling CI (#398)
Summary: Re-enable CI for gloo. 1. Disable libuv build in CI for windows as there are linker errors. Will resolve this later. 2. Remove tls_tcp_test.cc as this file does not exist anymore. 3. Put back win.cc and win.h files that were erroneously deleted. Pull Request resolved: #398 Reviewed By: d4l3k Differential Revision: D66522118 Pulled By: c-p-i-o fbshipit-source-id: b2b65a1ad50471059cb30fac2b019eda9c99c8fe
1 parent aeca183 commit accd654

File tree

6 files changed

+131
-5
lines changed

6 files changed

+131
-5
lines changed

.github/workflows/build.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
jobs:
9+
windows_build:
10+
runs-on: windows-latest
11+
env:
12+
gtest_lib_path: c:/googletest
13+
libuv_path: c:/libuv
14+
steps:
15+
- uses: conda-incubator/setup-miniconda@v3
16+
with:
17+
miniconda-version: "latest"
18+
- name: Add msbuild to PATH
19+
uses: microsoft/setup-msbuild@v2
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
- name: Set up Python 3.10
23+
uses: actions/setup-python@v3
24+
with:
25+
python-version: '3.10'
26+
- name: Add conda to system path
27+
run: |
28+
# $CONDA is an environment variable pointing to the root of the miniconda directory
29+
echo $CONDA/bin >> $GITHUB_PATH
30+
- name: Conda info
31+
shell: bash -l {0}
32+
run: conda info
33+
- name: Setup build environment
34+
run: |
35+
conda create -n py376_build python=3.7.6
36+
conda activate py376_build
37+
conda install cmake
38+
- name: Install libuv
39+
run: |
40+
conda activate py376_build
41+
curl https://dist.libuv.org/dist/v1.38.0/libuv-v1.38.0.tar.gz --output libuv-v1.38.0.tar.gz
42+
tar xzvf libuv-v1.38.0.tar.gz
43+
cd libuv-v1.38.0
44+
mkdir -p build
45+
cd build
46+
mkdir -p ${{ env.gtest_lib_path }}
47+
cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.libuv_path }}
48+
msbuild INSTALL.vcxproj
49+
- name: Install googletest
50+
run: |
51+
conda activate py376_build
52+
curl https://codeload.github.com/google/googletest/tar.gz/release-1.10.0 --output googletest-release-1.10.0.tar.gz
53+
tar xzvf googletest-release-1.10.0.tar.gz
54+
cd googletest-release-1.10.0
55+
mkdir -p build
56+
cd build
57+
if (Test-Path -Path ${{ env.gtest_lib_path }}) {
58+
echo "Directory already exists"
59+
} else {
60+
mkdir ${{ env.gtest_lib_path }}
61+
}
62+
cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.gtest_lib_path }} -Dgtest_force_shared_crt=ON
63+
msbuild INSTALL.vcxproj
64+
- name: Build
65+
run: |
66+
conda activate py376_build
67+
git submodule sync
68+
git submodule update --init --recursive
69+
mkdir -p build
70+
cd build
71+
cmake .. -DBUILD_TEST=ON -Dlibuv_ROOT=${{ env.libuv_path }} -DGTEST_LIBRARY=${{ env.gtest_lib_path }}/lib/gtestd.lib -DGTEST_INCLUDE_DIR=${{ env.gtest_lib_path }}/include -DGTEST_MAIN_LIBRARY=${{ env.gtest_lib_path }}/lib/gtest_maind.lib
72+
msbuild ALL_BUILD.vcxproj
73+
- name: Test
74+
run: |
75+
build/gloo/test/Debug/gloo_test.exe

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ if(MSVC)
5353
message(STATUS "Set USE_NCCL OFF")
5454
set(USE_RCCL OFF)
5555
message(STATUS "Set USE_RCCL OFF")
56-
set(USE_LIBUV ON)
57-
message(STATUS "Set USE_LIBUV ON")
58-
message(STATUS "Only USE_LIBUV is supported on Windows")
56+
set(USE_LIBUV OFF)
57+
message(STATUS "Set USE_LIBUV OFF")
58+
# message(STATUS "Only USE_LIBUV is supported on Windows")
5959

6060
if(BUILD_BENCHMARK)
6161
message(FATAL_ERROR "BUILD_BENCHMARK is not supported on Windows yet")

gloo/common/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if(MSVC)
2929
)
3030
list(APPEND GLOO_COMMON_SRCS
3131
"${CMAKE_CURRENT_SOURCE_DIR}/win.cc"
32-
)
32+
)
3333
endif()
3434

3535
list(APPEND GLOO_SRCS ${GLOO_COMMON_SRCS})

gloo/common/win.cc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Copyright (c) 2017-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
#include "gloo/common/win.h"
10+
#include "gloo/common/logging.h"
11+
12+
#include <mutex>
13+
14+
namespace gloo {
15+
16+
static std::once_flag init_flag;
17+
18+
// The WSAStartup function must be the first Windows Sockets function
19+
// called by an application or DLL.
20+
// https://docs.microsoft.com/ru-ru/windows/win32/api/winsock/nf-winsock-wsastartup
21+
22+
void init_winsock() {
23+
std::call_once(init_flag, []() {
24+
WSADATA wsa_data;
25+
int res;
26+
res = WSAStartup(MAKEWORD(2, 2), &wsa_data);
27+
if (res != 0) {
28+
GLOO_ENFORCE(false, "WSAStartup failed: ", res);
29+
}
30+
});
31+
}
32+
33+
} // namespace gloo

gloo/common/win.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright (c) 2017-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
#pragma once
10+
11+
#include <winsock2.h>
12+
13+
#pragma comment(lib, "Ws2_32.lib")
14+
15+
namespace gloo {
16+
17+
void init_winsock();
18+
19+
} // namespace gloo

gloo/test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ set(GLOO_TEST_SRCS
1616
"${CMAKE_CURRENT_SOURCE_DIR}/openssl_utils.cc"
1717
"${CMAKE_CURRENT_SOURCE_DIR}/reduce_test.cc"
1818
"${CMAKE_CURRENT_SOURCE_DIR}/send_recv_test.cc"
19-
"${CMAKE_CURRENT_SOURCE_DIR}/tls_tcp_test.cc"
2019
)
2120
set(GLOO_TEST_LIBRARIES)
2221

0 commit comments

Comments
 (0)