Skip to content

Commit

Permalink
Trying to fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
artiomn authored Nov 6, 2024
1 parent 2e2625a commit e9084cb
Showing 1 changed file with 77 additions and 62 deletions.
139 changes: 77 additions & 62 deletions .github/workflows/cmake-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,34 @@ on:
branches: [ "master" ]

jobs:
build:
unix_build:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
# 1. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]
build_type: [Debug]
c_compiler: [gcc, clang, cl]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
pre_run_command:
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl
# exclude:
# - os: windows-latest
# c_compiler: gcc
# - os: windows-latest
# c_compiler: clang
# - os: ubuntu-latest
# c_compiler: cl

steps:
- uses: actions/checkout@v4
Expand All @@ -71,73 +66,93 @@ jobs:
if: ${{ matrix.os }} == 'windows-latest'
with:
boost_version: 1.81.0
boost_install_dir: C:\boost
boost_install_dir: C:/
platform_version: 2022
toolset: msvc

- name: Configure non Windows CMake
if: ${{ matrix.os }} != 'windows-latest'
- name: Configure
run: >
docker run --rm -v ${{ github.workspace }}:/KNP -w /KNP ${{ vars.DOCKERHUB_LOGIN }}/knp-build-image cmake -B ${{ steps.strings.outputs.build-output-dir }}_${{ matrix.c_compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S .
- name: Configure Windows CMake
if: ${{ matrix.os }} == 'windows-latest'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}_${{ matrix.c_compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S .
- name: Build for non Windows
if: ${{ matrix.os }} != 'windows-latest'
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: docker run --rm -v ${{ github.workspace }}:/KNP -w /KNP ${{ vars.DOCKERHUB_LOGIN }}/knp-build-image cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 8
timeout-minutes: 180

- name: Build for Windows
if: ${{ matrix.os }} == 'windows-latest'
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 8
timeout-minutes: 180

- name: Test for non Windows
if: ${{ matrix.os }} != 'windows-latest'
- name: Test
run: docker run --rm -v ${{ github.workspace }}:/KNP -w /KNP/${{ steps.strings.outputs.build-output-dir }}/knp/tests ${{ vars.DOCKERHUB_LOGIN }}/knp-build-image ctest -V
timeout-minutes: 180

- name: Test for Windows
if: ${{ matrix.os }} == 'windows-latest'
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }} -V
timeout-minutes: 180

- name: Create deb packages
if: ${{ matrix.os }} != 'windows-latest'
run: docker run --rm -v ${{ github.workspace }}:/KNP -w /KNP/${{ steps.strings.outputs.build-output-dir }} ${{ vars.DOCKERHUB_LOGIN }}/knp-build-image cpack -G DEB
timeout-minutes: 180

- name: Create new release
id: create_release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && ${{ matrix.c_compiler }} == 'gcc'
uses: softprops/action-gh-release@v1
env:
# This token is provided by Actions.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
files: |
${{ steps.strings.outputs.build-output-dir }}/_packages/*.deb
body: |
Release creating added to CI
draft: false
prerelease: false
windows_build:
runs-on: windows-latest

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

# Set up a matrix to run:
matrix:
build_type: [Debug]
include:
- build_type: Debug

# <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
steps:
- uses: actions/checkout@v4
- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=build_windows" >> "$GITHUB_OUTPUT"
- name: Configure CMake
env:
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=cl
-DCMAKE_C_COMPILER=cl
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S .
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 8
timeout-minutes: 180

- name: Test
run: ctest --build-config ${{ matrix.build_type }} -V
timeout-minutes: 180

publish:
runs-on: ubuntu-latest
steps:
- name: Create new release
id: create_release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
env:
# This token is provided by Actions.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
files: |
${{ steps.strings.outputs.build-output-dir }}/_packages/*.deb
body: |
Release creating added to CI
draft: false
prerelease: false


# - name: Publish package to the PyPI
# Already on push in the master branch.
Expand Down

0 comments on commit e9084cb

Please sign in to comment.