Skip to content

Make a smoke test CI for PRs #4

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
23 changes: 8 additions & 15 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,21 @@ Checks: "*,
-abseil-*,
-altera-*,
-android-*,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-non-private-member-variables-in-classes,
-fuchsia-*,
-google-*,
-llvm*,
-misc-non-private-member-variables-in-classes,
-modernize-use-trailing-return-type,
-zircon-*,
-readability-avoid-const-params-in-decls,
-readability-braces-around-statements
-readability-else-after-return,
-readability-identifier-length,
-readability-static-accessed-through-instance,
-readability-avoid-const-params-in-decls,
-cppcoreguidelines-non-private-member-variables-in-classes,
-misc-non-private-member-variables-in-classes,
-zircon-*,
"
WarningsAsErrors: ''
HeaderFilterRegex: ''
FormatStyle: none

CheckOptions:
- key: readability-identifier-length.IgnoredVariableNames
value: 'x|y|z'
- key: readability-identifier-length.IgnoredParameterNames
value: 'x|y|z'





4 changes: 1 addition & 3 deletions .github/workflows/ci.yml → .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: ci
name: ci-main
on:
pull_request:
release:
types: [published]
push:
tags:
branches:
- main
- develop
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: ci-pr
on:
pull_request:
branches:
- main

env:
VERBOSE: 1

jobs:
Test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false

matrix:
os:
- ubuntu-20.04
- macos-10.15
- windows-2019
compiler:
# you can specify the version after `-` like "llvm-15.0.2".
- llvm-15.0.2
- gcc-11
generator:
- "Ninja Multi-Config"
build_type:
- Debug
packaging_maintainer_mode:
- OFF
build_shared:
- OFF

exclude:
# mingw is determined by this author to be too buggy to support
- os: windows-2019
compiler: gcc-11

include:
# Windows msvc builds
- os: windows-2022
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Debug
packaging_maintainer_mode: Off
enable_ipo: On

steps:
- name: Check for llvm version mismatches
if: ${{ contains(matrix.compiler, 'llvm') && !contains(matrix.compiler, env.CLANG_TIDY_VERSION) }}
uses: actions/github-script@v3
with:
script: |
core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen')

- uses: actions/checkout@v3

- name: Setup Cache
uses: ./.github/actions/setup_cache
with:
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
packaging_maintainer_mode: ${{ matrix.packaging_maintainer_mode }}
generator: ${{ matrix.generator }}

- name: Project Name
uses: cardinalby/export-env-action@v2
with:
envFile: '.github/constants.env'


- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}

cmake: true
ninja: true
vcpkg: false
ccache: true
clangtidy: false

- name: Configure CMake
run: |
cmake -S . -B ./build -G "${{matrix.generator}}" -D${{ env.PROJECT_NAME }}_ENABLE_IPO=${{matrix.enable_ipo }} -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -D${{ env.PROJECT_NAME }}_PACKAGING_MAINTAINER_MODE:BOOL=${{matrix.packaging_maintainer_mode}} -D${{ env.PROJECT_NAME }}_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }}

- name: Build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: |
cmake --build ./build --config ${{matrix.build_type}}

- name: Tests
working-directory: ./build
run: |
ctest -C ${{matrix.build_type}}
1 change: 1 addition & 0 deletions test/initial_draft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class segment {
segment(segment&&) noexcept = default;
segment& operator=(const segment&) = default;
segment& operator=(segment&&) noexcept = default;
~segment() = default;

template <class F>
auto append(F&& f) && {
Expand Down
7 changes: 4 additions & 3 deletions test/tuple_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
#include <tuple>
#include <utility>

#include <chains/tuple.hpp>

TEST_CASE("Test tuple compose", "[tuple_compose]") {
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers)
std::tuple t{[](int x) { return x + 1.0; }, [](double x) { return x * 2.0; },
[](double x) { return std::to_string(x / 2.0); }};
REQUIRE(chains::tuple_compose(std::move(t))(1) == "2.000000");
// NOLINTEND
REQUIRE(chains::tuple_compose(std::move(t))(1) ==
"2.000000"); // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
}