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

fix: EOL problems running CMake tests on Windows #63

Merged
merged 7 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
17 changes: 14 additions & 3 deletions .github/workflows/windows-visual-studio-cminpack-install.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,52 @@
name: MSVC - Install cminpack on Windows through CMake
run-name: MSVC - Build, test and install cminpack on Windows through CMake
on: [push]
on: [push, pull_request]

jobs:
cminpack-visual-studio:
name: cminpack (MSVC toolchain + CMake)
runs-on: windows-latest

defaults:
run:
shell: cmd

strategy:
matrix:
ARCH: [ 'x64', 'Win32']
CMINPACK_BUILD_SHARED_LIBS: [ 'ON' , 'OFF' ]
CMINPACK_BUILD_TYPE: [ 'Release', 'Debug', 'RelWithDebInfo', 'MinSizeRel' ]
CMINPACK_PRECISION: [ 'd' ] # seems to be the only precision that the current tests reference work

env:
CMINPACK_BUILD_DIR: >-
%RUNNER_TEMP%\cminpack-build-arch-${{ matrix.ARCH }}-shared-libs-${{ matrix.CMINPACK_BUILD_SHARED_LIBS }}-build-type-${{ matrix.CMINPACK_BUILD_TYPE }}-precision-${{ matrix.CMINPACK_PRECISION }}
CMINPACK_INSTALL_DIR: >-
%RUNNER_TEMP%\cminpack-install-arch-${{ matrix.ARCH }}-shared-libs-${{ matrix.CMINPACK_BUILD_SHARED_LIBS }}-build-type-${{ matrix.CMINPACK_BUILD_TYPE }}-precision-${{ matrix.CMINPACK_PRECISION }}

steps:
- name: Checkout sources with CRLF EOLs for reference test files
run: git config --global core.autocrlf true
- name: Checkout repository to cminpack directory
uses: actions/checkout@v4
with:
path: cminpack

- name: Configure cminpack build
run: cmake -DBUILD_SHARED_LIBS=${{ matrix.CMINPACK_BUILD_SHARED_LIBS }} -DCMAKE_BUILD_TYPE=${{ matrix.CMINPACK_BUILD_TYPE }} -DCMINPACK_PRECISION=${{ matrix.CMINPACK_PRECISION }} -DUSE_BLAS=OFF -A ${{ matrix.ARCH }} --install-prefix ${{ env.CMINPACK_INSTALL_DIR }} -S cminpack -B ${{ env.CMINPACK_BUILD_DIR }}

- name: Build cminpack
run: cmake --build ${{ env.CMINPACK_BUILD_DIR }} --config ${{ matrix.CMINPACK_BUILD_TYPE }}

- name: Test cminpack
run: ctest --test-dir ${{ env.CMINPACK_BUILD_DIR }} --build-config ${{ matrix.CMINPACK_BUILD_TYPE }}

- name: Install cminpack
run: cmake --install ${{ env.CMINPACK_BUILD_DIR }} --config ${{ matrix.CMINPACK_BUILD_TYPE }}

- name: Delete checkout directory
run: rmdir /S /Q cminpack

- name: Delete build directory
run: rmdir /S /Q ${{ env.CMINPACK_BUILD_DIR }}

- name: Delete install directory
run: rmdir /S /Q ${{ env.CMINPACK_INSTALL_DIR }}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The name of our project is "CMINPACK". CMakeLists files in this project can
# refer to the root source directory of the project as ${CMINPACK_SOURCE_DIR} and
# to the root binary directory of the project as ${CMINPACK_BINARY_DIR}.
cmake_minimum_required (VERSION 3.5)
cmake_minimum_required (VERSION 3.14)

if (NOT DEFINED CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
Expand Down
73 changes: 2 additions & 71 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ environment:
platform:
- x64

init: # Only MSVC toolchain will hit here
# This is needed because reference files for tests must be checked-out with CRLF EOLs
- git config --global core.autocrlf true

for:
#
# init specific instructions for MSYS2 x86_64 toolchain
Expand All @@ -41,73 +37,10 @@ for:
matrix:
only:
- job_name: MSYS2 x86_64 toolchain

init:
# This is needed because reference files for tests must be checked-out with CRLF EOLs
- git config --global core.autocrlf true

#
# Following the guide on https://www.msys2.org/docs/ci#appveyor
# to build the project using MSYS2 toolchain on appveyor CI service
#
# Update MSYS2
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu" # Core update (in case any core packages are outdated)
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu" # Normal update

# Setup MSYS2 environment
- set MSYSTEM=%SYS_MSYSTEM% # Start a 64 bit Mingw environment

# Install gcc on MSYS2
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-%SYS_MENVIRONMENT%-gcc"
# Install GNU Make on MSYS2
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-%SYS_MENVIRONMENT%-make"

# Adjust system PATH environment variable
- set PATH=C:\msys64\%SYS_MSYSTEM%\bin;%PATH% # Place MSYS2 tools in front of system PATH

#
# init specific instructions for MSYS2 UCRT64 toolchain
#
-
matrix:
only:
- job_name: MSYS2 UCRT64 toolchain

init:
# This is needed because reference files for tests must be checked-out with CRLF EOLs
- git config --global core.autocrlf true

#
# Following the guide on https://www.msys2.org/docs/ci#appveyor
# to build the project using MSYS2 toolchain on appveyor CI service
#
# Update MSYS2
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu" # Core update (in case any core packages are outdated)
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu" # Normal update

# Setup MSYS2 environment
- set MSYSTEM=%SYS_MSYSTEM% # Start a 64 bit Mingw environment

# Install gcc on MSYS2
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-%SYS_MENVIRONMENT%-gcc"
# Install GNU Make on MSYS2
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-%SYS_MENVIRONMENT%-make"

# Adjust system PATH environment variable
- set PATH=C:\msys64\%SYS_MSYSTEM%\bin;%PATH% # Place MSYS2 tools in front of system PATH

#
# init specific instructions for MSYS2 CLANG64 toolchain
#
-
matrix:
only:
- job_name: MSYS2 CLANG64 toolchain

init:
# This is needed because reference files for tests must be checked-out with CRLF EOLs
- git config --global core.autocrlf true

#
# Following the guide on https://www.msys2.org/docs/ci#appveyor
# to build the project using MSYS2 toolchain on appveyor CI service
Expand All @@ -119,10 +52,8 @@ for:
# Setup MSYS2 environment
- set MSYSTEM=%SYS_MSYSTEM% # Start a 64 bit Mingw environment

# Install clang on MSYS2
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-%SYS_MENVIRONMENT%-clang"
# Install GNU Make on MSYS2
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-%SYS_MENVIRONMENT%-make"
# Install C compiler + GNU Make on MSYS2
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-%SYS_MENVIRONMENT%-cc mingw-w64-%SYS_MENVIRONMENT%-make"

# Adjust system PATH environment variable
- set PATH=C:\msys64\%SYS_MSYSTEM%\bin;%PATH% # Place MSYS2 tools in front of system PATH
Expand Down
2 changes: 1 addition & 1 deletion examples/runtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if(NOT ${RET} EQUAL 0)
endif()
# result with reference
execute_process(COMMAND "${CMAKE_COMMAND}"
-E compare_files "${OUTPUT}" "${REFERENCE}"
-E compare_files --ignore-eol "${OUTPUT}" "${REFERENCE}"
RESULT_VARIABLE RET)
# if the test does not return 0, then fail it
if(NOT ${RET} EQUAL 0)
Expand Down