Skip to content

Commit 2e57950

Browse files
authored
Merge pull request #105 from pageldev/ci/setup-ci-pipeline
ci/setup ci pipeline
2 parents 298bde6 + 25cea93 commit 2e57950

File tree

5 files changed

+54
-5
lines changed

5 files changed

+54
-5
lines changed

.github/workflows/ci.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build-linux:
7+
name: ubuntu-22.04-release
8+
runs-on: ubuntu-22.04
9+
defaults:
10+
run:
11+
shell: bash -e -o pipefail {0}
12+
steps:
13+
- name: checkout repository
14+
uses: actions/checkout@v4
15+
- name: check format
16+
run: ./format-files.sh check
17+
- name: configure
18+
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
19+
- name: build
20+
run: cmake --build build
21+
- name: test
22+
run: ctest --test-dir build --output-on-failure
23+
- name: install
24+
run: sudo cmake --install build
25+
build-windows:
26+
name: windows-2022-release
27+
runs-on: windows-2022
28+
defaults:
29+
run:
30+
shell: C:\msys64\usr\bin\bash.exe {0}
31+
steps:
32+
- name: checkout repository
33+
uses: actions/checkout@v4
34+
- name: configure
35+
run: cmake -S . -B build -G "Visual Studio 17 2022"
36+
- name: build
37+
run: cmake --build build --config Release
38+
- name: test
39+
run: ctest --test-dir build --output-on-failure
40+
- name: install
41+
run: cmake --install build --config Release

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set(CMAKE_CXX_STANDARD 17)
99
set(CMAKE_CXX_STANDARD_REQUIRED True)
1010

1111
if(MSVC)
12-
set(CMAKE_CXX_FLAGS "/EHsc /Wall")
12+
set(CMAKE_CXX_FLAGS "/EHsc /W3")
1313
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS 1)
1414
set(CMAKE_CXX_FLAGS_RELEASE "/O2")
1515
add_compile_definitions(_USE_MATH_DEFINES)

format-files.sh

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/usr/bin/env bash
22

3+
set -euo pipefail
4+
5+
MODE="${1:-default}"
6+
37
PROJ_ROOT=$(dirname $0)
48

59
if ! type -p clang-format >/dev/null; then
@@ -21,7 +25,13 @@ else
2125
exit 1
2226
fi
2327

28+
EXTRA_FLAGS=""
29+
if [[ "$MODE" == "check" ]]; then
30+
echo "check mode enabled, not formatting files, only checking"
31+
EXTRA_FLAGS="--dry-run --Werror"
32+
fi
33+
2434
find "${PROJ_ROOT}" -type f \
2535
\( -name "*.cpp" -o -name "*.c" -o -name "*.hpp" -o -name "*.h" \) \
2636
-not -path "${PROJ_ROOT}/build/*" \
27-
-print -exec clang-format --style=file -i '{}' \;
37+
-print0 | xargs -0 clang-format $EXTRA_FLAGS --style=file --verbose -i

include/Math.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#pragma once
2-
#define _USE_MATH_DEFINES
32
#include <algorithm>
43
#include <array>
54
#include <cmath>

src/Geometries/Spiral/odrSpiral.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@
3535
*/
3636

3737
/* ====== INCLUSIONS ====== */
38-
#include <stdio.h>
39-
#define _USE_MATH_DEFINES
4038
#include <math.h>
39+
#include <stdio.h>
4140

4241
namespace odr
4342
{

0 commit comments

Comments
 (0)