Skip to content

Commit

Permalink
Merge pull request #25 from elbeno/update-from-cicd
Browse files Browse the repository at this point in the history
⬆️ 👷 Update workflow from upstream
  • Loading branch information
elbeno committed Oct 12, 2023
2 parents 8692f8f + 09a1c39 commit cdd8729
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 32 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/asciidoctor-ghpages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ env:
jobs:
configure:
name: Configure Github Pages Publishing
runs-on: intel-ubuntu-22.04
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-22.04
outputs:
enable_publish: ${{ steps.check.outputs.isfork == 'NO' }}
steps:
- id: check
name: Check if Fork
run: |
if [ "${{ github.repository }}" = "intel/compile-time-init-build" ]; then
if [ "${{ github.repository_owner }}" = "intel" ]; then
echo "This is the main repository, **enabling publishing**" >> "$GITHUB_STEP_SUMMARY"
echo "isfork=NO" >> "$GITHUB_OUTPUT"
else
Expand All @@ -29,7 +29,7 @@ jobs:
build:
needs: configure
name: Build Documentation
runs-on: intel-ubuntu-22.04
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-22.04
steps:
- name: Checkout source
uses: actions/checkout@v4
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
environment:
name: github-pages
url: $${{ steps.deployment.outputs.page_url }}
runs-on: intel-ubuntu-22.04
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-22.04
steps:
- name: Deploy to github pages
id: deployment
Expand Down
40 changes: 29 additions & 11 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
DEBIAN_FRONTEND: noninteractive
CMAKE_GENERATOR: Ninja
DEFAULT_CXX_STANDARD: 20
DEFAULT_LLVM_VERSION: 16
DEFAULT_LLVM_VERSION: 17
DEFAULT_GCC_VERSION: 12

concurrency:
Expand All @@ -21,12 +21,12 @@ concurrency:

jobs:
build_and_test:
runs-on: ubuntu-22.04
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-22.04
strategy:
fail-fast: false
matrix:
compiler: [clang, gcc]
version: [12, 13, 14, 15, 16]
version: [12, 13, 14, 15, 16, 17]
cxx_standard: [20]
stdlib: [libstdc++, libc++]
build_type: [Debug]
Expand All @@ -35,6 +35,15 @@ jobs:
cc: "clang"
cxx: "clang++"
cxx_flags: "-stdlib=libstdc++"
- version: 17
compiler: clang
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 17
toolchain_root: "/usr/lib/llvm-17"
- version: 17
compiler: clang
stdlib: libc++
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 17 && sudo apt install -y libc++-17-dev libc++abi-17-dev
cxx_flags: "-stdlib=libc++"
- version: 16
compiler: clang
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 16
Expand Down Expand Up @@ -77,6 +86,8 @@ jobs:
cxx: "g++-12"
cxx_flags: ""
exclude:
- compiler: gcc
version: 17
- compiler: gcc
version: 16
- compiler: gcc
Expand Down Expand Up @@ -112,19 +123,19 @@ jobs:
run: ctest -j $(nproc) -C ${{matrix.build_type}}

quality_checks_pass:
runs-on: ubuntu-22.04
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Install build tools
run: |
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh ${{env.DEFAULT_LLVM_VERSION}}
sudo apt install -y ninja-build clang-tidy-${{env.DEFAULT_LLVM_VERSION}} clang-format-${{env.DEFAULT_LLVM_VERSION}}
sudo apt install -y python3-pip ninja-build clang-tidy-${{env.DEFAULT_LLVM_VERSION}} clang-format-${{env.DEFAULT_LLVM_VERSION}}
- name: Install cmake-format
run: |
pip3 install --upgrade pip
pip3 install pyyaml cmake-format
sudo pip3 install --upgrade pip
sudo pip3 install pyyaml cmake-format
- name: Configure CMake
env:
Expand All @@ -136,7 +147,7 @@ jobs:
run: cmake --build ${{github.workspace}}/build -t quality

sanitize:
runs-on: ubuntu-22.04
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand All @@ -161,7 +172,7 @@ jobs:
run: cmake --build ${{github.workspace}}/build -t unit_tests

valgrind:
runs-on: ubuntu-22.04
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-22.04
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -211,8 +222,15 @@ jobs:
test $FAILSIZE = "0"
merge_ok:
runs-on: ubuntu-22.04
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-22.04
needs: [build_and_test, quality_checks_pass, sanitize, valgrind]
if: ${{ always() }}
steps:
- name: Enable merge
run: echo "OK to merge!"
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
}}
run: exit 1
28 changes: 13 additions & 15 deletions include/safe/algorithm/accumulate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,20 @@ template <auto count> inline consteval auto fold(auto e, auto op) {
);

} else if constexpr (count > 10) {
return safe::dsl::detail::simp(op(
op(op(op(op(op(op(op(op(op(fold<count - 10>(e, op), e), e),
e),
e),
e),
e),
e),
e),
e),
e));
return safe::dsl::detail::simp(op(
op(op(op(op(op(op(op(op(op(fold<count - 10>(e, op), e), e), e), e),
e),
e),
e),
e),
e),
e));

} else if constexpr (count > 1) {
return safe::dsl::detail::simp(op(fold<count - 1>(e, op), e));
return safe::dsl::detail::simp(op(fold<count - 1>(e, op), e));

} else {
return e;
return e;
}
}

Expand All @@ -69,9 +67,9 @@ template <size_t max_iter>
auto iter_count = size_t{};
auto sum = init;
while ((first != last) && (iter_count < max_iter)) {
sum = op(sum, (*first).unsafe_value());
first++;
iter_count++;
sum = op(sum, (*first).unsafe_value());
first++;
iter_count++;
}

return unsafe_cast<var<ret_num_t, sum_req>>(sum);
Expand Down
4 changes: 2 additions & 2 deletions include/safe/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ template <typename T, std::size_t Size> struct array {

constexpr void fill(T const &value) { storage.fill(value); }

constexpr void swap(array &other) { storage.swap(other.storage); }
constexpr void swap(array &other) noexcept { storage.swap(other.storage); }

[[nodiscard]] friend constexpr auto operator==(array const &lhs,
array const &rhs) -> bool {
Expand Down Expand Up @@ -164,7 +164,7 @@ template <std::size_t I, class T, std::size_t N>
}

template <class T, std::size_t N>
constexpr void swap(safe::array<T, N> &lhs, safe::array<T, N> &rhs) {
constexpr void swap(safe::array<T, N> &lhs, safe::array<T, N> &rhs) noexcept {
lhs.swap(rhs);
}

Expand Down

0 comments on commit cdd8729

Please sign in to comment.