Skip to content

Commit e671e54

Browse files
authored
👷 Add CI support (#6)
1 parent d9b7bb2 commit e671e54

File tree

6 files changed

+175
-10
lines changed

6 files changed

+175
-10
lines changed

.github/actions/badge/action.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Regular badging sequence
2+
description: Publishes a badge based on the job status
3+
inputs:
4+
category:
5+
description: The subfolder where to group the badges
6+
required: true
7+
badges:
8+
description: A json object of label => status for all badges
9+
required: true
10+
github_token:
11+
description: The token to use to publish the changes
12+
required: false
13+
default: ${{ github.token }}
14+
runs:
15+
using: composite
16+
steps:
17+
- run: |
18+
node ./.github/actions/badge/write-json-object.js ${{ inputs.category }} '${{ inputs.badges }}'
19+
shell: bash
20+
- uses: peaceiris/actions-gh-pages@v3
21+
with:
22+
github_token: ${{ inputs.github_token }}
23+
publish_branch: badges
24+
publish_dir: ./badges
25+
keep_files: true
26+
user_name: "github-actions[bot]"
27+
user_email: "github-actions[bot]@users.noreply.github.com"
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const fs = require('fs');
2+
const category = process.argv[2];
3+
const status = JSON.parse(process.argv[3]);
4+
5+
if (!fs.existsSync("./badges")) fs.mkdirSync("./badges");
6+
if (!fs.existsSync("./badges/" + category)) fs.mkdirSync("./badges/" + category);
7+
for (let e in status) {
8+
const path = "./badges/" + category + "/" + e;
9+
if (!fs.existsSync(path)) fs.mkdirSync(path);
10+
const ok = status[e] == "success";
11+
fs.writeFileSync(path + "/shields.json", JSON.stringify({
12+
"schemaVersion": 1,
13+
"label": e,
14+
"message": ok ? "Passing" : "Failing",
15+
"color": ok ? "brightgreen" : "red"
16+
}));
17+
}
+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Compiler Compatibility CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
compiler:
14+
- { tag: "ubuntu-2204_clang-13", name: "Ubuntu 22.04 Clang 13", cxx: "/usr/bin/clang++-13", cc: "/usr/bin/clang-13", runs-on: "ubuntu-22.04" }
15+
- { tag: "ubuntu-2204_clang-14", name: "Ubuntu 22.04 Clang 14", cxx: "/usr/bin/clang++-14", cc: "/usr/bin/clang-14", runs-on: "ubuntu-22.04" }
16+
- { tag: "ubuntu-2204_clang-15", name: "Ubuntu 22.04 Clang 15", cxx: "/usr/bin/clang++-15", cc: "/usr/bin/clang-15", runs-on: "ubuntu-22.04" }
17+
- { tag: "ubuntu-2204_gcc-10", name: "Ubuntu 22.04 G++ 10", cxx: "/usr/bin/g++-10", cc: "/usr/bin/gcc-10", runs-on: "ubuntu-22.04" }
18+
- { tag: "ubuntu-2204_gcc-11", name: "Ubuntu 22.04 G++ 11", cxx: "/usr/bin/g++-11", cc: "/usr/bin/gcc-11", runs-on: "ubuntu-22.04" }
19+
- { tag: "ubuntu-2004_clang-12", name: "Ubuntu 20.04 Clang 12", cxx: "/usr/bin/clang++-12", cc: "/usr/bin/clang-12", runs-on: "ubuntu-20.04" }
20+
- { tag: "ubuntu-2004_clang-11", name: "Ubuntu 20.04 Clang 11", cxx: "/usr/bin/clang++-11", cc: "/usr/bin/clang-11", runs-on: "ubuntu-20.04" }
21+
- { tag: "ubuntu-2004_clang-10", name: "Ubuntu 20.04 Clang 10", cxx: "/usr/bin/clang++-10", cc: "/usr/bin/clang-10", runs-on: "ubuntu-20.04" }
22+
- { tag: "ubuntu-2004_gcc-10", name: "Ubuntu 20.04 G++ 10", cxx: "/usr/bin/g++-10", cc: "/usr/bin/gcc-10", runs-on: "ubuntu-20.04" }
23+
runs-on: ${{ matrix.compiler.runs-on }}
24+
name: Compiler ${{ matrix.compiler.name }}
25+
env:
26+
CXX: ${{ matrix.compiler.cxx }}
27+
CC: ${{ matrix.compiler.cc }}
28+
outputs:
29+
# Because github wants us to suffer we need to list out every output instead of using a matrix statement or some kind of dynamic setting
30+
ubuntu-2204_clang-13: ${{ steps.status.outputs.ubuntu-2204_clang-13 }}
31+
ubuntu-2204_clang-14: ${{ steps.status.outputs.ubuntu-2204_clang-14 }}
32+
ubuntu-2204_clang-15: ${{ steps.status.outputs.ubuntu-2204_clang-15 }}
33+
ubuntu-2204_gcc-10: ${{ steps.status.outputs.ubuntu-2204_gcc-10 }}
34+
ubuntu-2204_gcc-11: ${{ steps.status.outputs.ubuntu-2204_gcc-11 }}
35+
ubuntu-2004_clang-12: ${{ steps.status.outputs.ubuntu-2004_clang-12 }}
36+
ubuntu-2004_clang-11: ${{ steps.status.outputs.ubuntu-2004_clang-11 }}
37+
ubuntu-2004_clang-10: ${{ steps.status.outputs.ubuntu-2004_clang-10 }}
38+
ubuntu-2004_gcc-10: ${{ steps.status.outputs.ubuntu-2004_gcc-10 }}
39+
defaults:
40+
run:
41+
shell: bash -l {0}
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v3
45+
# Ubuntu 22.04 container has libstdc++13 installed which is incompatible with clang < 15 in C++20
46+
- name: Uninstall libstdc++-13-dev
47+
if: (matrix.compiler.tag == 'ubuntu-2204_clang-14') || (matrix.compiler.tag == 'ubuntu-2204_clang-13')
48+
run: |
49+
sudo apt autoremove libstdc++-13-dev gcc-13 libgcc-13-dev
50+
sudo apt install -y --no-install-recommends libstdc++-12-dev gcc-12 libgcc-12-dev
51+
- name: Install dependencies
52+
if: startsWith(matrix.compiler.tag,'ubuntu-2204')
53+
run: |
54+
sudo apt install -y --no-install-recommends liburing-dev
55+
- name: Install dependencies
56+
if: startsWith(matrix.compiler.tag,'ubuntu-2004')
57+
run: |
58+
sudo apt install -y --no-install-recommends libc6-dev wget
59+
wget http://de.archive.ubuntu.com/ubuntu/pool/main/libu/liburing/liburing2_2.1-2build1_amd64.deb
60+
wget http://de.archive.ubuntu.com/ubuntu/pool/main/libu/liburing/liburing-dev_2.1-2build1_amd64.deb
61+
sudo dpkg -i liburing*.deb
62+
rm liburing*.deb
63+
- name: Install gtest
64+
uses: ./.github/actions/install/gtest
65+
- name: Configure
66+
run: cmake -S. -Bbuild -DASYNCPP_BUILD_TEST=ON -DASYNCPP_WITH_ASAN=ON -DASYNCPP_WITH_TSAN=OFF
67+
- name: Build
68+
run: cmake --build build --config Debug
69+
- name: Test
70+
working-directory: ${{ github.workspace }}/build
71+
run: ./asyncpp_uring-test
72+
- name: Update Result
73+
id: status
74+
if: ${{ always() }}
75+
run: echo "${{ matrix.compiler.tag }}=${{ job.status }}" >> $GITHUB_OUTPUT
76+
77+
badge-upload:
78+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && always() }}
79+
needs: [build]
80+
runs-on: ubuntu-20.04
81+
name: Publish badges
82+
steps:
83+
- name: Checkout repository
84+
uses: actions/checkout@v3
85+
- name: Publish Badges
86+
uses: ./.github/actions/badge
87+
with:
88+
category: compiler
89+
badges: ${{ toJson(needs.build.outputs) }}
90+

CMakeLists.txt

+17-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,19 @@ if(OP_LAST_COMPILE_RESULT)
4040
INTERFACE ASYNCPP_URING_OP_LAST=${OP_LAST})
4141
endif()
4242
# mismatched-new-delete: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109224
43-
target_compile_options(asyncpp_uring INTERFACE -Wall -Wextra -Wpedantic -Werror
44-
-Wno-error=mismatched-new-delete)
45-
43+
target_compile_options(asyncpp_uring INTERFACE -Wall -Wextra -Wpedantic)
44+
# Clang10 does not know about likely/unlikely macros, however since those are
45+
# only hints we just disable the warning
46+
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION
47+
VERSION_LESS 12.0)
48+
target_compile_options(asyncpp_uring INTERFACE -Wno-error=unknown-attributes)
49+
endif()
50+
# G++10 does not know about Wmismatched-new-delete
51+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION
52+
VERSION_GREATER 11.0)
53+
target_compile_options(asyncpp_uring
54+
INTERFACE -Wno-error=mismatched-new-delete)
55+
endif()
4656
if(ASYNCPP_BUILD_TEST)
4757
enable_testing()
4858
include(GoogleTest)
@@ -69,21 +79,25 @@ if(ASYNCPP_BUILD_TEST)
6979
target_compile_options(asyncpp_uring-test PRIVATE -fsanitize=address)
7080
target_link_libraries(asyncpp_uring-test PRIVATE asan)
7181
endif()
82+
target_compile_options(asyncpp_uring-test PRIVATE -Werror)
7283

7384
gtest_discover_tests(asyncpp_uring-test)
7485
endif()
7586

7687
if(ASYNCPP_BUILD_EXAMPLES)
7788
add_executable(uring-info ${CMAKE_CURRENT_SOURCE_DIR}/examples/uring-info.cpp)
7889
target_link_libraries(uring-info PRIVATE asyncpp_uring)
90+
target_compile_options(uring-info PRIVATE -Werror)
7991

8092
add_executable(echo-server
8193
${CMAKE_CURRENT_SOURCE_DIR}/examples/echo-server.cpp)
8294
target_link_libraries(echo-server PRIVATE asyncpp_uring)
95+
target_compile_options(echo-server PRIVATE -Werror)
8396

8497
add_executable(echo-client
8598
${CMAKE_CURRENT_SOURCE_DIR}/examples/echo-client.cpp)
8699
target_link_libraries(echo-client PRIVATE asyncpp_uring)
100+
target_compile_options(echo-client PRIVATE -Werror)
87101

88102
if(ASYNCPP_WITH_ASAN)
89103
target_compile_options(uring-info PRIVATE -fsanitize=address)

README.md

+21-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,24 @@ This library provides a c++20 coroutine wrapper around the modern linux io_uring
33
It is an addition to [async++](https://github.com/asyncpp/asyncpp) which provides general coroutine tasks and support classes.
44

55
Tested and supported compilers:
6-
* Clang 12
7-
* Clang 14
6+
[![ubuntu-2004_clang-10][img_ubuntu-2004_clang-10]][Compiler-Support]
7+
[![ubuntu-2004_clang-11][img_ubuntu-2004_clang-11]][Compiler-Support]
8+
[![ubuntu-2004_clang-12][img_ubuntu-2004_clang-12]][Compiler-Support]
9+
[![ubuntu-2004_gcc-10][img_ubuntu-2004_gcc-10]][Compiler-Support]
10+
[![ubuntu-2204_clang-13][img_ubuntu-2204_clang-13]][Compiler-Support]
11+
[![ubuntu-2204_clang-14][img_ubuntu-2204_clang-14]][Compiler-Support]
12+
[![ubuntu-2204_clang-15][img_ubuntu-2204_clang-15]][Compiler-Support]
13+
[![ubuntu-2204_gcc-11][img_ubuntu-2204_gcc-11]][Compiler-Support]
14+
[![ubuntu-2204_gcc-10][img_ubuntu-2204_gcc-10]][Compiler-Support]
15+
16+
17+
[img_ubuntu-2004_clang-10]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/asyncpp/asyncpp-uring/badges/compiler/ubuntu-2004_clang-10/shields.json
18+
[img_ubuntu-2004_clang-11]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/asyncpp/asyncpp-uring/badges/compiler/ubuntu-2004_clang-11/shields.json
19+
[img_ubuntu-2004_clang-12]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/asyncpp/asyncpp-uring/badges/compiler/ubuntu-2004_clang-12/shields.json
20+
[img_ubuntu-2004_gcc-10]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/asyncpp/asyncpp-uring/badges/compiler/ubuntu-2004_gcc-10/shields.json
21+
[img_ubuntu-2204_clang-13]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/asyncpp/asyncpp-uring/badges/compiler/ubuntu-2204_clang-13/shields.json
22+
[img_ubuntu-2204_clang-14]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/asyncpp/asyncpp-uring/badges/compiler/ubuntu-2204_clang-14/shields.json
23+
[img_ubuntu-2204_clang-15]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/asyncpp/asyncpp-uring/badges/compiler/ubuntu-2204_clang-15/shields.json
24+
[img_ubuntu-2204_gcc-10]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/asyncpp/asyncpp-uring/badges/compiler/ubuntu-2204_gcc-10/shields.json
25+
[img_ubuntu-2204_gcc-11]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/asyncpp/asyncpp-uring/badges/compiler/ubuntu-2204_gcc-11/shields.json
26+
[Compiler-Support]: https://github.com/asyncpp/asyncpp-uring/actions/workflows/compiler-support.yml

test/index_set.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
#include "asyncpp/uring/index_set.h"
21
#include <asyncpp/fire_and_forget.h>
2+
#include <asyncpp/uring/index_set.h>
33
#include <asyncpp/uring/io_service.h>
4-
#include <chrono>
54
#include <cstddef>
65
#include <cstdint>
76
#include <gtest/gtest.h>
87
#include <limits>
9-
#include <ratio>
108
#include <stdexcept>
119
#include <sys/types.h>
1210

@@ -122,8 +120,8 @@ TEST(ASYNCPP_URING, IndexSetCopy) {
122120
TEST(ASYNCPP_URING, IndexSetSBO) {
123121
struct fail_allocator {
124122
using value_type = uint64_t;
125-
void deallocate(uint64_t* p, std::size_t n) { throw std::logic_error("attempt to deallocate"); }
126-
[[nodiscard]] uint64_t* allocate(std::size_t n) { throw std::logic_error("attempt to allocate"); }
123+
void deallocate([[maybe_unused]] uint64_t* p, [[maybe_unused]] std::size_t n) { throw std::logic_error("attempt to deallocate"); }
124+
[[nodiscard]] uint64_t* allocate([[maybe_unused]] std::size_t n) { throw std::logic_error("attempt to allocate"); }
127125
};
128126
index_set<uint16_t, fail_allocator> set{};
129127
for (size_t i = 0; i <= 16; i++) {

0 commit comments

Comments
 (0)