Skip to content

Commit 840745e

Browse files
committed
fix yml
Signed-off-by: Mateusz Mazur <mateusz.mazur@e.email>
1 parent 21f4b22 commit 840745e

File tree

1 file changed

+36
-28
lines changed

1 file changed

+36
-28
lines changed

.github/workflows/cmake-multi-platform.yml

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CMake on multiple platforms
22

33
on:
44
push:
5-
branches: [ "master" ]
5+
branches: ["master"]
66
pull_request:
7-
branches: [ "master" ]
7+
branches: ["master"]
88

99
jobs:
1010
build:
@@ -43,33 +43,41 @@ jobs:
4343
c_compiler: cl
4444

4545
steps:
46-
- uses: actions/checkout@v4
46+
- uses: actions/checkout@v4
4747

48-
- name: Set reusable strings
49-
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
50-
id: strings
51-
shell: bash
52-
run: |
53-
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
48+
- name: Install dependencies
49+
run: |
50+
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
51+
sudo apt-get update
52+
sudo apt-get install -y libnet1-dev
53+
fi
5454
55-
- name: Configure CMake
56-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
57-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
58-
run: >
59-
cmake -B ${{ steps.strings.outputs.build-output-dir }}
60-
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
61-
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
62-
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
63-
-DMODBUS_EXAMPLE=ON
64-
-DMODBUS_TEST=ON
65-
-S ${{ github.workspace }}
55+
- name: Set reusable strings
56+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
57+
id: strings
58+
shell: bash
59+
run: |
60+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
6661
67-
- name: Build
68-
# 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).
69-
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
62+
- name: Configure CMake
63+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
64+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
65+
run: >
66+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
67+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
68+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
69+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
70+
-DMODBUS_EXAMPLE=ON
71+
-DMODBUS_TEST=ON
72+
-DMODBUS_COMMUNICATION=${{ matrix.os == 'windows-latest' && 'OFF' || matrix.os == 'ubuntu-latest' && 'ON' }}
73+
-S ${{ github.workspace }}
7074
71-
- name: Test
72-
working-directory: ${{ steps.strings.outputs.build-output-dir }}
73-
# 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).
74-
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
75-
run: build/tests/Google_Tests_run
75+
- name: Build
76+
# 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).
77+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
78+
79+
- name: Test
80+
working-directory: ${{ steps.strings.outputs.build-output-dir }}
81+
# 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).
82+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
83+
run: build/tests/Google_Tests_run

0 commit comments

Comments
 (0)