Skip to content

Commit 957abc2

Browse files
workflows: update build and packaging to fix (#10)
* workflows: update build and packaging to fix Signed-off-by: Patrick Stephens <[email protected]> * workflows: fix up linting Signed-off-by: Patrick Stephens <[email protected]> --------- Signed-off-by: Patrick Stephens <[email protected]>
1 parent 1fc7db1 commit 957abc2

File tree

8 files changed

+221
-12
lines changed

8 files changed

+221
-12
lines changed

.github/workflows/build.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,29 @@ jobs:
7474
shell: bash
7575
working-directory: cprofiles/build
7676

77+
build-debian:
78+
name: Debian Buster build to confirm no issues once used downstream
79+
runs-on: ubuntu-latest
80+
container: debian:buster
81+
steps:
82+
- name: Set up base image dependencies
83+
run: |
84+
apt-get update
85+
apt-get install -y build-essential cmake make git
86+
shell: bash
87+
88+
- uses: actions/checkout@v4
89+
with:
90+
submodules: true
91+
92+
- name: Run compilation
93+
run: |
94+
cmake -DCPROF_TESTS=On ../
95+
cmake --build .
96+
CTEST_OUTPUT_ON_FAILURE=1 ctest
97+
shell: bash
98+
working-directory: build
99+
77100
build-unix-arm64:
78101
name: Build sources on arm64 for ${{ matrix.os }} - ${{ matrix.compiler }}
79102
runs-on: ${{ matrix.os }}
@@ -161,3 +184,29 @@ jobs:
161184
# dependencies_debian: ''
162185
cmakeflags: '-DCPROF_TESTS=On -DCPROF_DEV=on .'
163186
build_command: make all
187+
188+
# this job provides the single required status for PRs to be merged into main.
189+
# instead of updating the protected branch status in github, developers can update the needs section below
190+
# to require additional status checks to protect main.
191+
# the job uses the alls-green action to get around the github issue that treats a "skipped" required status check
192+
# as passed. github will skip a job if an upstream needed job fails, which would defeat the purpose of this required
193+
# status check.
194+
test-required-checks-complete:
195+
# note: this step always has to run in order to check if the dependent jobs passed. by default github skips running a job
196+
# if the needed jobs upstream failed.
197+
if: always()
198+
needs:
199+
- build-windows
200+
- build-centos
201+
- build-debian
202+
- build-unix-arm64
203+
- build-unix-amd64
204+
- build-analysis-tests
205+
name: Required checks complete
206+
runs-on: ubuntu-latest
207+
permissions: {}
208+
steps:
209+
- name: Decide whether the needed jobs succeeded or failed
210+
uses: re-actors/alls-green@release/v1
211+
with:
212+
jobs: ${{ toJSON(needs) }}

.github/workflows/lint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v4
1313
- uses: ludeeus/action-shellcheck@master
14+
with:
15+
ignore_paths: cmake/**
1416

1517
actionlint-pr:
1618
runs-on: ubuntu-latest

.github/workflows/packages.yaml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Build packages for master or a tagged release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
# Any tag starting with 'v'
8+
tags:
9+
- 'v*'
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-distro-packages-arm64:
14+
runs-on: ubuntu-latest
15+
name: build arm64 packages
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
format: [ rpm, deb ]
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
submodules: true
24+
25+
- uses: uraimo/[email protected]
26+
name: Build the ${{matrix.format}} packages
27+
with:
28+
arch: aarch64
29+
distro: ubuntu_latest
30+
run: |
31+
apt-get update && \
32+
apt-get install -y --no-install-recommends \
33+
build-essential \
34+
cmake \
35+
file \
36+
rpm \
37+
make
38+
cmake .
39+
echo ${{ matrix.format }} | awk '{print toupper($0)}' | xargs -I{} cpack -G {}
40+
41+
- name: Store the master package artifacts
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: ${{ matrix.format }}-arm64
45+
path: |
46+
./*.${{matrix.format}}
47+
48+
build-distro-packages-amd64:
49+
name: build amd64 packages
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
format: [ rpm, deb ]
54+
runs-on: [ ubuntu-latest ]
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
submodules: true
59+
60+
- name: Build the ${{matrix.format}} packages
61+
run: |
62+
cmake .
63+
echo ${{ matrix.format }} | awk '{print toupper($0)}' | xargs -I{} cpack -G {}
64+
65+
- name: Store the master package artifacts
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: ${{ matrix.format }}-amd64
69+
path: |
70+
./*.${{matrix.format}}
71+
72+
build-macos-packages-arm64:
73+
name: build macOS Apple Silicon packages
74+
strategy:
75+
fail-fast: true
76+
matrix:
77+
config:
78+
- format: productbuild
79+
arch: apple
80+
ext: pkg
81+
runs-on: macos-14
82+
steps:
83+
- uses: actions/checkout@v4
84+
with:
85+
submodules: true
86+
87+
- name: Build the ${{matrix.config.format}} packages
88+
run: |
89+
cmake . -DCPACK_GENERATOR=${{ matrix.config.format }}
90+
echo ${{ matrix.config.format }} | xargs -I{} cpack -G {}
91+
92+
- name: Store the master package artifacts
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: ${{ matrix.config.format }}-${{matrix.config.arch}}
96+
path: |
97+
./*-${{matrix.config.arch}}.${{matrix.config.ext}}
98+
99+
release:
100+
name: Create release and upload packages
101+
needs:
102+
- build-distro-packages-amd64
103+
- build-distro-packages-arm64
104+
- build-macos-packages-arm64
105+
runs-on: ubuntu-latest
106+
permissions:
107+
contents: write
108+
steps:
109+
- name: Download all artefacts
110+
uses: actions/download-artifact@v4
111+
with:
112+
path: artifacts/
113+
114+
- name: Display structure of downloaded files
115+
run: ls -R
116+
working-directory: artifacts
117+
shell: bash
118+
119+
- name: Unstable release on push to master to make it easier to download
120+
uses: pyTooling/Actions/releaser@r0
121+
continue-on-error: true
122+
with:
123+
token: ${{ secrets.GITHUB_TOKEN }}
124+
tag: 'unstable'
125+
rm: true
126+
files: |
127+
artifacts/**/*
128+
129+
- name: Release on tag
130+
uses: softprops/action-gh-release@v2
131+
if: startsWith(github.ref, 'refs/tags/')
132+
with:
133+
generate_release_notes: true
134+
files: |
135+
artifacts/**/*

.mdlrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
style "#{File.dirname(__FILE__)}/markdownlint.rb"

CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Global Owners
2+
# -------------
3+
* @edsiper @leonardo-albertovich
4+
5+
# CI
6+
# -------------------------
7+
/.github/ @niedbalski @patrick-stephens @celalettin1286

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The [CProfiles](https://github.com/fluent/cprofiles) provides a simple API to create and manage profiles for monitoring and observability purposes, the internal data structure is based on OpenTelemetry Profiles schema (v1/development):
44

5-
- https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/profiles/v1development/profiles.proto
5+
- <https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/profiles/v1development/profiles.proto>
66

77
## Build
88

@@ -33,7 +33,7 @@ make
3333

3434
For now you can try out the unit test that compiles when dev mode is enabled: `tests/cprof-test-profile`:
3535

36-
```
36+
```text
3737
--- profile debug
3838
Profile Duration: 0 nanoseconds
3939

cmake/sanitizers-cmake/README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,49 @@
11
# sanitizers-cmake
22

3-
[![](https://img.shields.io/github/issues-raw/arsenm/sanitizers-cmake.svg?style=flat-square)](https://github.com/arsenm/sanitizers-cmake/issues)
3+
[![Issues](https://img.shields.io/github/issues-raw/arsenm/sanitizers-cmake.svg?style=flat-square)](https://github.com/arsenm/sanitizers-cmake/issues)
44
[![MIT](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE)
55

66
CMake module to enable sanitizers for binary targets.
77

8-
98
## Include into your project
109

1110
To use [FindSanitizers.cmake](cmake/FindSanitizers.cmake), simply add this repository as git submodule into your own repository
12-
```Shell
11+
12+
```shell
1313
mkdir externals
1414
git submodule add [email protected]:arsenm/sanitizers-cmake.git externals/sanitizers-cmake
1515
```
16+
1617
and adding ```externals/sanitizers-cmake/cmake``` to your ```CMAKE_MODULE_PATH```
18+
1719
```CMake
1820
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
1921
```
2022

2123
If you don't use git or dislike submodules you can copy the files in [cmake directory](cmake) into your repository. *Be careful and keep updates in mind!*
2224

2325
Now you can simply run ```find_package``` in your CMake files:
26+
2427
```CMake
2528
find_package(Sanitizers)
2629
```
2730

28-
2931
## Usage
3032

3133
You can enable the sanitizers with ``SANITIZE_ADDRESS``, ``SANITIZE_MEMORY``, ``SANITIZE_THREAD`` or ``SANITIZE_UNDEFINED`` options in your CMake configuration. You can do this by passing e.g. ``-DSANITIZE_ADDRESS=On`` on your command line or with your graphical interface.
3234

3335
If sanitizers are supported by your compiler, the specified targets will be build with sanitizer support. If your compiler has no sanitizing capabilities (I asume intel compiler doesn't) you'll get a warning but CMake will continue processing and sanitizing will simply just be ignored.
3436

35-
#### Compiler issues
37+
## Compiler issues
3638

3739
Different compilers may be using different implementations for sanitizers. If you'll try to sanitize targets with C and Fortran code but don't use gcc & gfortran but clang & gfortran, this will cause linking problems. To avoid this, such problems will be detected and sanitizing will be disabled for these targets.
3840

3941
Even C only targets may cause problems in certain situations. Some problems have been seen with AddressSanitizer for preloading or dynamic linking. In such cases you may try the ``SANITIZE_LINK_STATIC`` to link sanitizers for gcc static.
4042

41-
42-
4343
## Build targets with sanitizer support
4444

4545
To enable sanitizer support you simply have to add ``add_sanitizers(<TARGET>)`` after defining your target. To provide a sanitizer blacklist file you can use the ``sanitizer_add_blacklist_file(<FILE>)`` function:
46+
4647
```CMake
4748
find_package(Sanitizers)
4849
@@ -59,15 +60,13 @@ add_sanitizers(some_lib)
5960

6061
The sanitizers check your program, while it's running. In some situations (e.g. LD_PRELOAD your target) it might be required to preload the used AddressSanitizer library first. In this case you may use the ``asan-wrapper`` script defined in ``ASan_WRAPPER`` variable to execute your application with ``${ASan_WRAPPER} myexe arg1 ...``.
6162

62-
6363
## Contribute
6464

6565
Anyone is welcome to contribute. Simply fork this repository, make your changes **in an own branch** and create a pull-request for your change. Please do only one change per pull-request.
6666

6767
You found a bug? Please fill out an [issue](https://github.com/arsenm/sanitizers-cmake/issues) and include any data to reproduce the bug.
6868

69-
70-
#### Contributors
69+
## Contributors
7170

7271
* [Matt Arsenault](https://github.com/arsenm)
7372
* [Alexander Haase](https://github.com/alehaa)

markdownlint.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/ruby
2+
3+
# Enable all rules by default
4+
all
5+
6+
# Extend line length, since each sentence should be on a separate line.
7+
rule 'MD013', :line_length => 99999, :ignore_code_blocks => true
8+
9+
# Allow in-line HTML
10+
exclude_rule 'MD033'
11+
12+
# Nested lists should be indented with two spaces.
13+
rule 'MD007', :indent => 2
14+
15+
# Bash defaulting confuses this and now way to ignore code blocks
16+
exclude_rule 'MD029'

0 commit comments

Comments
 (0)