Skip to content

Commit dd1101d

Browse files
authored
Merge pull request #20 from bdeane-intel/update-cicd
👷 Update to use common CI/CD
2 parents 356293b + 975526e commit dd1101d

30 files changed

+123
-858
lines changed

.clang-format

Lines changed: 0 additions & 16 deletions
This file was deleted.

.clang-tidy

Lines changed: 0 additions & 39 deletions
This file was deleted.

.cmake-format.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "daily"
12+
- package-ecosystem: "gitsubmodule"
13+
directory: "/" # Location of package manifests
14+
schedule:
15+
interval: "daily"
Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,41 @@
1-
name: GitHub Pages Publish
1+
name: Publish GitHub Pages
22

33
on:
44
workflow_dispatch:
55
push:
66
branches: [ main ]
77

8+
env:
9+
DEBIAN_FRONTEND: noninteractive
10+
811
jobs:
912
build:
10-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-22.04
1114

1215
steps:
13-
- name: Checkout Source
14-
uses: actions/checkout@v3
16+
- name: Checkout source
17+
uses: actions/checkout@v4
1518

16-
- name: Install asciidoc
19+
- name: Install asciidoctor
1720
run: |
1821
sudo apt update
19-
DEBIAN_FRONTEND=noninteractive TZ=America/Los_Angeles sudo apt-get install -y git wget asciidoctor
20-
sudo gem install asciidoctor-diagram
22+
sudo apt install -y asciidoctor
23+
sudo gem install asciidoctor asciidoctor-diagram rouge
2124
22-
- name: Build Documentation
25+
- name: Build documentation
2326
run: |
2427
mkdir -p ./generated-html
25-
asciidoctor -r asciidoctor-diagram doc/index.adoc -D ./generated-html
26-
if [ -e doc/static ]; then cp -rf doc/static ./generated-html; fi
28+
asciidoctor -r asciidoctor-diagram docs/index.adoc -D ./generated-html
29+
if [ -e docs/static ]; then cp -rf docs/static ./generated-html; fi
2730
touch ./generated-html/.nojekyll
2831
ls -la ./generated-html
2932
cat ./generated-html/index.html
3033
31-
- name: Build Single Header
32-
run: |
33-
pushd include
34-
python3 ../tools/gen_release_header.py safe.hpp > ../generated-html/safe.hpp
35-
popd
36-
37-
- name: Setup GH-Pages
34+
- name: Setup github pages
3835
uses: actions/configure-pages@v3
3936

40-
- name: Upload Artifacts to GH-Pages
41-
uses: actions/upload-pages-artifact@v1
37+
- name: Upload artifacts
38+
uses: actions/upload-pages-artifact@v2
4239
with:
4340
path: ./generated-html
4441

@@ -54,9 +51,9 @@ jobs:
5451
name: github-pages
5552
url: $${{ steps.deployment.outputs.page_url }}
5653

57-
runs-on: ubuntu-20.04
54+
runs-on: ubuntu-22.04
5855

5956
steps:
60-
- name: Deploy to GitHub Pages
57+
- name: Deploy to github pages
6158
id: deployment
62-
uses: actions/deploy-pages@v1
59+
uses: actions/deploy-pages@v2

.github/workflows/unit_tests.yml

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
env:
1212
DEBIAN_FRONTEND: noninteractive
1313
CMAKE_GENERATOR: Ninja
14+
DEFAULT_CXX_STANDARD: 20
15+
DEFAULT_LLVM_VERSION: 16
16+
DEFAULT_GCC_VERSION: 12
1417

1518
concurrency:
1619
group: ${{ github.head_ref || github.run_id }}
@@ -31,6 +34,7 @@ jobs:
3134
- compiler: clang
3235
cc: "clang"
3336
cxx: "clang++"
37+
cxx_flags: "-stdlib=libstdc++"
3438
- version: 16
3539
compiler: clang
3640
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 16
@@ -39,6 +43,7 @@ jobs:
3943
compiler: clang
4044
stdlib: libc++
4145
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 16 && sudo apt install -y libc++-16-dev libc++abi-16-dev
46+
cxx_flags: "-stdlib=libc++"
4247
- version: 15
4348
compiler: clang
4449
install: sudo apt update && sudo apt install -y clang-15
@@ -47,6 +52,7 @@ jobs:
4752
compiler: clang
4853
stdlib: libc++
4954
install: sudo apt update && sudo apt install -y clang-15 libc++-15-dev libc++abi-15-dev
55+
cxx_flags: "-stdlib=libc++"
5056
- version: 14
5157
compiler: clang
5258
install: sudo apt update && sudo apt install -y clang-14
@@ -55,18 +61,21 @@ jobs:
5561
compiler: clang
5662
stdlib: libc++
5763
install: sudo apt update && sudo apt install -y clang-14 libc++-14-dev libc++abi-14-dev
64+
cxx_flags: "-stdlib=libc++"
65+
- compiler: gcc
66+
toolchain_root: "/usr"
67+
cxx_flags: ""
5868
- version: 13
5969
compiler: gcc
6070
install: sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt update && sudo apt-get install -y gcc-13 g++-13
61-
toolchain_root: "/usr"
6271
cc: "gcc-13"
6372
cxx: "g++-13"
6473
- version: 12
6574
compiler: gcc
6675
install: sudo apt update && sudo apt install -y gcc-12
67-
toolchain_root: "/usr"
6876
cc: "gcc-12"
6977
cxx: "g++-12"
78+
cxx_flags: ""
7079
exclude:
7180
- compiler: gcc
7281
version: 16
@@ -82,7 +91,7 @@ jobs:
8291
stdlib: libc++
8392

8493
steps:
85-
- uses: actions/checkout@v3
94+
- uses: actions/checkout@v4
8695

8796
- name: Install build tools
8897
run: |
@@ -93,9 +102,7 @@ jobs:
93102
env:
94103
CC: ${{matrix.toolchain_root}}/bin/${{matrix.cc}}
95104
CXX: ${{matrix.toolchain_root}}/bin/${{matrix.cxx}}
96-
CXX_STANDARD: ${{matrix.cxx_standard}}
97-
CXX_STDLIB: ${{matrix.stdlib}}
98-
run: cmake -B ${{github.workspace}}/build -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/toolchains/${{matrix.compiler}}.cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
105+
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{matrix.cxx_standard}} -DCMAKE_CXX_FLAGS_INIT=${{matrix.cxx_flags}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
99106

100107
- name: Build Unit Tests
101108
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -v -t build_unit_tests
@@ -107,12 +114,12 @@ jobs:
107114
quality_checks_pass:
108115
runs-on: ubuntu-22.04
109116
steps:
110-
- uses: actions/checkout@v3
117+
- uses: actions/checkout@v4
111118

112119
- name: Install build tools
113120
run: |
114-
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 16
115-
sudo apt install -y ninja-build clang-tidy-16 clang-format-16
121+
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh ${{env.DEFAULT_LLVM_VERSION}}
122+
sudo apt install -y ninja-build clang-tidy-${{env.DEFAULT_LLVM_VERSION}} clang-format-${{env.DEFAULT_LLVM_VERSION}}
116123
117124
- name: Install cmake-format
118125
run: |
@@ -121,10 +128,9 @@ jobs:
121128
122129
- name: Configure CMake
123130
env:
124-
CC: "/usr/lib/llvm-16/bin/clang"
125-
CXX: "/usr/lib/llvm-16/bin/clang++"
126-
CXX_STANDARD: 20
127-
run: cmake -B ${{github.workspace}}/build
131+
CC: "/usr/lib/llvm-${{env.DEFAULT_LLVM_VERSION}}/bin/clang"
132+
CXX: "/usr/lib/llvm-${{env.DEFAULT_LLVM_VERSION}}/bin/clang++"
133+
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}}
128134

129135
- name: Run quality checks
130136
run: cmake --build ${{github.workspace}}/build -t quality
@@ -137,38 +143,36 @@ jobs:
137143
sanitizer: [undefined, address, thread]
138144

139145
steps:
140-
- uses: actions/checkout@v3
146+
- uses: actions/checkout@v4
141147

142148
- name: Install build tools
143149
run: |
144-
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 16
150+
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh ${{env.DEFAULT_LLVM_VERSION}}
145151
sudo apt install -y ninja-build
146152
147153
- name: Configure CMake
148154
env:
149-
CC: "/usr/lib/llvm-16/bin/clang"
150-
CXX: "/usr/lib/llvm-16/bin/clang++"
151-
CXX_STANDARD: 20
155+
CC: "/usr/lib/llvm-${{env.DEFAULT_LLVM_VERSION}}/bin/clang"
156+
CXX: "/usr/lib/llvm-${{env.DEFAULT_LLVM_VERSION}}/bin/clang++"
152157
SANITIZERS: ${{matrix.sanitizer}}
153-
run: cmake -B ${{github.workspace}}/build
158+
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}}
154159

155160
- name: Build Unit Tests
156161
run: cmake --build ${{github.workspace}}/build -t unit_tests
157162

158163
valgrind:
159164
runs-on: ubuntu-22.04
160165
steps:
161-
- uses: actions/checkout@v3
166+
- uses: actions/checkout@v4
162167

163168
- name: Install build tools
164169
run: sudo apt update && sudo apt install -y gcc-12 ninja-build valgrind
165170

166171
- name: Configure CMake
167172
env:
168-
CC: "/usr/bin/gcc-12"
169-
CXX: "/usr/bin/g++-12"
170-
CXX_STANDARD: 20
171-
run: cmake -B ${{github.workspace}}/build
173+
CC: "/usr/bin/gcc-${{env.DEFAULT_GCC_VERSION}}"
174+
CXX: "/usr/bin/g++-${{env.DEFAULT_GCC_VERSION}}"
175+
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}}
172176

173177
- name: Build Unit Tests
174178
run: cmake --build ${{github.workspace}}/build -t build_unit_tests

.gitignore

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
.DS_Store
2-
*.lst
3-
*.orign
4-
/Testing/
5-
/build/
1+
/build
62
/cmake-build-*
7-
.idea
8-
.vscode
9-
.cache
3+
/venv
4+
/.vscode
5+
/.idea
6+
/.cache
7+
/.DS_Store
8+
.clang-format
9+
.clang-tidy
10+
.cmake-format.yaml
11+
CMakePresets.json
12+
/toolchains

CMakeLists.txt

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,8 @@ cmake_minimum_required(VERSION 3.25)
22

33
project(safe_arithmetic LANGUAGES CXX)
44

5-
if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
6-
message(
7-
FATAL_ERROR
8-
"In-source builds are a bad idea. Please make a build directory instead."
9-
)
10-
endif()
11-
12-
include(cmake/dependencies.cmake)
13-
include(cmake/libraries.cmake)
14-
include(cmake/quality.cmake)
5+
include(cmake/get_cpm.cmake)
6+
cpmaddpackage("gh:intel/cicd-repo-infrastructure#main")
157

168
add_versioned_package("gh:boostorg/mp11#boost-1.83.0")
179

@@ -21,7 +13,7 @@ target_include_directories(safe_arithmetic INTERFACE include)
2113
target_link_libraries(safe_arithmetic INTERFACE boost_mp11)
2214

2315
if(PROJECT_IS_TOP_LEVEL)
24-
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
16+
add_docs(docs)
2517
clang_tidy_interface(safe_arithmetic)
2618
add_subdirectory(test)
2719
endif()

0 commit comments

Comments
 (0)