Skip to content

Commit

Permalink
Merge pull request #105 from pageldev/ci/setup-ci-pipeline
Browse files Browse the repository at this point in the history
ci/setup ci pipeline
  • Loading branch information
pageldev authored Jan 19, 2025
2 parents 298bde6 + 25cea93 commit 2e57950
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 5 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on: [push, pull_request]

jobs:
build-linux:
name: ubuntu-22.04-release
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -e -o pipefail {0}
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: check format
run: ./format-files.sh check
- name: configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
- name: build
run: cmake --build build
- name: test
run: ctest --test-dir build --output-on-failure
- name: install
run: sudo cmake --install build
build-windows:
name: windows-2022-release
runs-on: windows-2022
defaults:
run:
shell: C:\msys64\usr\bin\bash.exe {0}
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: configure
run: cmake -S . -B build -G "Visual Studio 17 2022"
- name: build
run: cmake --build build --config Release
- name: test
run: ctest --test-dir build --output-on-failure
- name: install
run: cmake --install build --config Release
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

if(MSVC)
set(CMAKE_CXX_FLAGS "/EHsc /Wall")
set(CMAKE_CXX_FLAGS "/EHsc /W3")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS 1)
set(CMAKE_CXX_FLAGS_RELEASE "/O2")
add_compile_definitions(_USE_MATH_DEFINES)
Expand Down
12 changes: 11 additions & 1 deletion format-files.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env bash

set -euo pipefail

MODE="${1:-default}"

PROJ_ROOT=$(dirname $0)

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

EXTRA_FLAGS=""
if [[ "$MODE" == "check" ]]; then
echo "check mode enabled, not formatting files, only checking"
EXTRA_FLAGS="--dry-run --Werror"
fi

find "${PROJ_ROOT}" -type f \
\( -name "*.cpp" -o -name "*.c" -o -name "*.hpp" -o -name "*.h" \) \
-not -path "${PROJ_ROOT}/build/*" \
-print -exec clang-format --style=file -i '{}' \;
-print0 | xargs -0 clang-format $EXTRA_FLAGS --style=file --verbose -i
1 change: 0 additions & 1 deletion include/Math.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <cmath>
Expand Down
3 changes: 1 addition & 2 deletions src/Geometries/Spiral/odrSpiral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@
*/

/* ====== INCLUSIONS ====== */
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>

namespace odr
{
Expand Down

0 comments on commit 2e57950

Please sign in to comment.