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

Add Windows CI #176

Merged
merged 36 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3adc7df
try rework github workflows
jeandemanged Oct 15, 2024
e89e73d
try rework github workflows
jeandemanged Oct 15, 2024
73a8181
clang tidy
jeandemanged Oct 16, 2024
d450945
clang tidy
jeandemanged Oct 16, 2024
fc6491b
clang tidy
jeandemanged Oct 16, 2024
cf78812
clang tidy
jeandemanged Oct 16, 2024
e90f5cd
clang tidy
jeandemanged Oct 16, 2024
ba6aa9f
clang tidy
jeandemanged Oct 16, 2024
0f32175
artifacts
jeandemanged Oct 16, 2024
c13fbf2
artifacts
jeandemanged Oct 16, 2024
3067cb0
artifacts
jeandemanged Oct 16, 2024
723273b
artifacts
jeandemanged Oct 16, 2024
a9528ad
wip
jeandemanged Oct 18, 2024
b1c03be
fix
jeandemanged Oct 18, 2024
4abfd50
wip windows ci
jeandemanged Oct 9, 2024
f97ab3f
wip windows ci
jeandemanged Oct 9, 2024
75c3322
wip windows ci
jeandemanged Oct 9, 2024
8cec70e
wip windows ci / cpp tests
jeandemanged Oct 9, 2024
d6c0adf
test
jeandemanged Oct 10, 2024
a0ceeb4
test
jeandemanged Oct 10, 2024
ce49058
test
jeandemanged Oct 10, 2024
bc9a44c
wip
jeandemanged Oct 18, 2024
fbd0925
Merge branch 'main' into gh-workflows
jeandemanged Oct 28, 2024
8d38a0d
Merge branch 'gh-workflows' into windows-ci
jeandemanged Oct 28, 2024
8a26229
fix
jeandemanged Oct 28, 2024
ca29d53
fix
jeandemanged Oct 28, 2024
766fc14
fix
jeandemanged Oct 28, 2024
82bb2fb
use softprops/action-gh-release
jeandemanged Nov 6, 2024
497f497
Merge branch 'refs/heads/gh-workflows' into windows-ci
jeandemanged Nov 6, 2024
bb3f3c0
use softprops/action-gh-release
jeandemanged Nov 6, 2024
fa69197
Merge branch 'main' into gh-workflows
jeandemanged Nov 6, 2024
236122b
Merge branch 'refs/heads/gh-workflows' into windows-ci
jeandemanged Nov 6, 2024
f1ea709
update readme for cmake 3.14
jeandemanged Nov 6, 2024
45a0c23
Merge branch 'refs/heads/main' into windows-ci
jeandemanged Nov 7, 2024
985fb9a
Merge branch 'main' into windows-ci
rolnico Nov 7, 2024
72bbc8c
Merge branch 'main' into windows-ci
rolnico Nov 7, 2024
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
49 changes: 49 additions & 0 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,55 @@ jobs:
metrix-simulator/build/install/bin
metrix-simulator/build/install/etc

cpp_windows:
name: Build C++ Windows
runs-on: windows-latest
defaults:
run:
shell: cmd
env:
BOOST_ROOT: C:\thirdparties\boost-1.72.0
BOOST_URL: https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0/boost_1_72_0-msvc-14.2-64.exe/download
steps:
- name: Install Boost
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
choco install wget --no-progress
wget -nv -O boost-installer.exe %BOOST_URL%
boost-installer.exe /dir=%BOOST_ROOT% /sp- /verysilent /suppressmsgboxes /norestart

- name: Checkout sources
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 #v4.1.6

- name: Configure 3rd parties
run: >
cmake -S %GITHUB_WORKSPACE%\metrix-simulator\external -B %GITHUB_WORKSPACE%\metrix-simulator\build\external

- name: Build 3rd parties
run: >
cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build\external --parallel 2 --config Release

- name: Configure CMake
run: >
cmake -Wno-dev -S %GITHUB_WORKSPACE%\metrix-simulator -B %GITHUB_WORKSPACE%\metrix-simulator\build
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\metrix-simulator\build\install

- name: Build
run: cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build --target install --parallel 2 --config Release

- name: Tests
run: cd %GITHUB_WORKSPACE%\metrix-simulator\build && ctest -j2 --output-on-failure -C Release

- name: Upload Metrix Simulator archive
if: ${{ github.event_name == 'workflow_dispatch' && inputs.generate_artifacts }}
uses: actions/upload-artifact@v3
with:
name: metrix-simulator-windows
path: |
metrix-simulator/build/install/bin
metrix-simulator/build/install/etc

cpp_ubuntu_qa:
name: Short QA C++ Ubuntu
runs-on: ubuntu-latest
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/full-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,46 @@ jobs:
- name: Tests
run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j2 --output-on-failure

cpp_windows:
name: Build C++ Windows
runs-on: windows-latest
defaults:
run:
shell: cmd
env:
BOOST_ROOT: C:\thirdparties\boost-1.72.0
BOOST_URL: https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0/boost_1_72_0-msvc-14.2-64.exe/download
steps:
- name: Install Boost
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
choco install wget --no-progress
wget -nv -O boost-installer.exe %BOOST_URL%
boost-installer.exe /dir=%BOOST_ROOT% /sp- /verysilent /suppressmsgboxes /norestart

- name: Checkout sources
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 #v4.1.6

- name: Configure 3rd parties
run: >
cmake -S %GITHUB_WORKSPACE%\metrix-simulator\external -B %GITHUB_WORKSPACE%\metrix-simulator\build\external

- name: Build 3rd parties
run: >
cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build\external --parallel 2 --config Release

- name: Configure CMake
run: >
cmake -Wno-dev -S %GITHUB_WORKSPACE%\metrix-simulator -B %GITHUB_WORKSPACE%\metrix-simulator\build
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\metrix-simulator\build\install

- name: Build
run: cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build --target install --parallel 2 --config Release

- name: Tests
run: cd %GITHUB_WORKSPACE%\metrix-simulator\build && ctest -j2 --output-on-failure -C Release

cpp_ubuntu_qa:
name: Full QA C++ Ubuntu
runs-on: ubuntu-latest
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,60 @@ jobs:
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
with:
files: ${{ steps.metrix-install.outputs.archive_path }}.zip

cpp_windows:
name: Package C++ Windows
runs-on: windows-latest
defaults:
run:
shell: cmd
env:
BOOST_ROOT: C:\thirdparties\boost-1.72.0
BOOST_URL: https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0/boost_1_72_0-msvc-14.2-64.exe/download
steps:
- name: Install Boost
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
choco install wget --no-progress
wget -nv -O boost-installer.exe %BOOST_URL%
boost-installer.exe /dir=%BOOST_ROOT% /sp- /verysilent /suppressmsgboxes /norestart

- name: Checkout sources
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 #v4.1.6

- name: Configure 3rd parties
run: >
cmake -S %GITHUB_WORKSPACE%\metrix-simulator\external -B %GITHUB_WORKSPACE%\metrix-simulator\build\external

- name: Build 3rd parties
run: >
cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build\external --parallel 2 --config Release

- name: Configure CMake
run: >
cmake -Wno-dev -S %GITHUB_WORKSPACE%\metrix-simulator -B %GITHUB_WORKSPACE%\metrix-simulator\build
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\metrix-simulator\build\install

- name: Build
run: cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build --target install --parallel 2 --config Release

- name: Tests
run: cd %GITHUB_WORKSPACE%\metrix-simulator\build && ctest -j2 --output-on-failure -C Release

- name: Prepare Metrix package
id: metrix-install
shell: powershell
run: |
$env:ARCHIVE_NAME = "metrix-simulator-windows"
$env:ARCHIVE_PATH = "$env:GITHUB_WORKSPACE\$env:ARCHIVE_NAME"
$env:ARCHIVE_PATH = $env:ARCHIVE_PATH -replace '\\','/'
cd $env:GITHUB_WORKSPACE/metrix-simulator/build/install
Compress-Archive -Path bin,etc -Destination $env:ARCHIVE_PATH
echo "archive_name=$env:ARCHIVE_NAME" >> "$env:GITHUB_OUTPUT"
echo "archive_path=$env:ARCHIVE_PATH" >> "$env:GITHUB_OUTPUT"

- name: Upload release package
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
with:
files: ${{ steps.metrix-install.outputs.archive_path }}.zip
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ all input options are described in --help option

To build metrix-simulator, you need:
- A C++ compiler that supports C++11 ([clang](https://clang.llvm.org) 3.3 or higher, [g++](https://gcc.gnu.org) 5.0 or higher)
- [CMake](https://cmake.org) (3.12 or higher)
- [CMake](https://cmake.org) (3.14 or higher)
- [Make](https://www.gnu.org/software/make/)
- [Boost](https://www.boost.org) development packages (1.66 or higher)

Expand All @@ -199,9 +199,9 @@ $> apt install -y g++ git libboost-all-dev libxml2-dev make wget

**Note:** Under Ubuntu 18.04, the default CMake package is too old (3.10), so you have to install it manually:
```
$> wget https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz
$> tar xzf cmake-3.12.0-Linux-x86_64.tar.gz
$> export PATH=$PWD/cmake-3.12.0-Linux-x86_64/bin:$PATH
$> wget https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.tar.gz
$> tar xzf cmake-3.14.0-Linux-x86_64.tar.gz
$> export PATH=$PWD/cmake-3.14.0-Linux-x86_64/bin:$PATH
```

###### CentOS 8
Expand All @@ -211,9 +211,9 @@ $> yum install -y boost-devel gcc-c++ git libxml2-devel make wget

**Note:** Under CentOS 8, the default CMake package is too old (3.11.4), so you have to install it manually:
```
$> wget https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz
$> tar xzf cmake-3.12.0-Linux-x86_64.tar.gz
$> export PATH=$PWD/cmake-3.12.0-Linux-x86_64/bin:$PATH
$> wget https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.tar.gz
$> tar xzf cmake-3.14.0-Linux-x86_64.tar.gz
$> export PATH=$PWD/cmake-3.14.0-Linux-x86_64/bin:$PATH
```

###### CentOS 7
Expand All @@ -230,9 +230,9 @@ $> export BOOST_LIBRARYDIR=/usr/lib64/boost166

**Note:** Under CentOS 7, the default CMake package is too old (2.8.12), so you have to install it manually:
```
$> wget https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz
$> tar xzf cmake-3.12.0-Linux-x86_64.tar.gz
$> export PATH=$PWD/cmake-3.12.0-Linux-x86_64/bin:$PATH
$> wget https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.tar.gz
$> tar xzf cmake-3.14.0-Linux-x86_64.tar.gz
$> export PATH=$PWD/cmake-3.14.0-Linux-x86_64/bin:$PATH
```
##### Build sources

Expand Down
7 changes: 5 additions & 2 deletions metrix-simulator/CMakeLists.txt
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not really a cmake expert ... feedback welcome

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# SPDX-License-Identifier: MPL-2.0
#

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For --ignore-eol option in tests, see metrix-simulator/cmake/tnr.cmake


include(CMakePackageConfigHelpers)

Expand All @@ -28,12 +28,14 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(INSTALL_CMAKE_DIR cmake CACHE PATH "Installation directory for cmake files")

if(MSVC)
add_compile_definitions(WIN32)
add_definitions(-D_WIN32_WINNT=0x0A00)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

windows 10+

add_compile_definitions("_CRT_SECURE_NO_WARNINGS")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:5000000 ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# In release, we prefer speed over size of the code
set(CMAKE_CXX_FLAGS_RELEASE "/O2")
set(CMAKE_C_FLAGS_RELEASE "/O2")
set(Boost_USE_STATIC_RUNTIME ON)
else()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
Expand Down Expand Up @@ -142,6 +144,7 @@ target_link_libraries(${target}
SuiteSparse::SuiteSparse_BTF
SuiteSparse::SuiteSparse_Config
${Boost_LIBRARIES}
$<$<BOOL:${MSVC}>:msvcrt.lib>
)

if (USE_SIRIUS_SHARED)
Expand Down
3 changes: 1 addition & 2 deletions metrix-simulator/cmake/tnr.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#

function(check_file file expected_file)
configure_file(${file} ${file} NEWLINE_STYLE LF) # required for windows ctest
execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files ${file} ${expected_file}
execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${file} ${expected_file}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed this way because previous code was assuming code was checked out using LF end of files, but this is not the default git behavior on Windows.

Note that --ignore-eol requires cmake 3.14+

RESULT_VARIABLE compare_result)
if(compare_result)
MESSAGE(FATAL_ERROR "File " ${file} " is different from expected file " ${expected_file})
Expand Down
4 changes: 4 additions & 0 deletions metrix-simulator/log/src/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#include <algorithm>
#include <cstring>

#if defined(_MSC_VER)
#define localtime_r(T,Tm) (localtime_s(Tm,T) ? NULL : Tm)
#endif

using namespace boost::log;

namespace metrix
Expand Down
2 changes: 1 addition & 1 deletion metrix-simulator/tests/variantes_regroupees/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ set(TEST_DIR ${MAIN_TEST_DIR}/${TEST_DIR_NAME})
set(EXPECTED_TEST_DIR ${MAIN_TEST_DIR}_reference/${TEST_DIR_NAME})

if(METRIX_RUN_ALL_TESTS)
metrix_test("variantes_regroupees_complexe" 11) # no check here because of random and equivalent solutions
metrix_test_no_check("variantes_regroupees_complexe" 11) # no check here because of random and equivalent solutions
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the comment saying no check here because of random and equivalent solutions was already there...
On windows the results differ only in lines ordering.

Copy link
Member Author

@jeandemanged jeandemanged Oct 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

endif()
metrix_test("variantes_regroupees_simple" 8)
Loading