From f3c38b4462cce7358488e2acc5a8ee94ebf7b9e5 Mon Sep 17 00:00:00 2001 From: Hanspeter Portner Date: Mon, 6 Nov 2023 17:32:53 +0100 Subject: [PATCH] ci: update to .builds dir --- .build.yml | 17 -------- .builds/alpine-latest.yml | 76 ++++++++++++++++++++++++++++++++ meson.build | 91 ++++++++++++++++++++++----------------- meson_options.txt | 4 ++ 4 files changed, 132 insertions(+), 56 deletions(-) delete mode 100644 .build.yml create mode 100644 .builds/alpine-latest.yml diff --git a/.build.yml b/.build.yml deleted file mode 100644 index a69b788f..00000000 --- a/.build.yml +++ /dev/null @@ -1,17 +0,0 @@ -# SPDX-FileCopyrightText: Hanspeter Portner -# SPDX-License-Identifier: CC0-1.0 - -image: alpine/latest -packages: - - reuse - - meson -tasks: - - setup: | - cd lfrtm - meson setup build - - build: | - cd lfrtm - ninja -C build - - test: | - cd lfrtm - ninja -C build test diff --git a/.builds/alpine-latest.yml b/.builds/alpine-latest.yml new file mode 100644 index 00000000..f795b020 --- /dev/null +++ b/.builds/alpine-latest.yml @@ -0,0 +1,76 @@ +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: CC0-1.0 + +--- + +image: alpine/latest + +packages: + - clang16-analyzer + - llvm16 + - reuse + - meson + - git-subtree + - hut + - jq + - valgrind + +environment: + project: lfrtm + +secrets: + - 0545580c-42ac-4700-b322-4e9df924eb07 # runner-ssh + - 5fe806cd-3af4-4588-9898-8115d9262144 # hut-config + - d6d10b2a-542a-4b45-b1be-6ef30a8ab558 # git-config + - 3de1773e-3503-46f5-8ab4-5212026517f4 # pgp-key + +sources: + - https://git.open-music-kontrollers.ch/~hp/ci + +tasks: + - gcc: | + . ~/ci/activate + + ci-meson gcc setup + ci-meson gcc build + ci-meson gcc test + ci-meson gcc memcheck + + - clang: | + . ~/ci/activate + + ci-meson clang setup + ci-meson clang build + ci-meson clang test + ci-meson clang memcheck + + - analyzer: | + . ~/ci/activate + + ci-meson analyzer setup + ci-meson analyzer build + ci-meson analyzer test + + - sign: | + . ~/ci/activate + + if ! ci-istag; then + complete-build + fi + + ci-archivesign + + - deploy: | + . ~/ci/activate + + if ! ci-isrelease; then + complete-build + fi + + ci-subtreemerge + +triggers: + - action: email + condition: failure + to: "" +... diff --git a/meson.build b/meson.build index 977aa909..90313a96 100644 --- a/meson.build +++ b/meson.build @@ -4,62 +4,75 @@ project('lfrtm', 'c', default_options : [ 'buildtype=release', 'warning_level=3', - 'werror=true', - 'b_lto=false', + 'werror=false', + 'b_lto=true', 'c_std=c11']) +build_tests = get_option('build-tests') + reuse = find_program('reuse', required : false) add_project_arguments('-D_GNU_SOURCE', language : 'c') -thread_dep = dependency('threads') +cc = meson.get_compiler('c') +rt_dep = cc.find_library('rt') -lib_deps = [] +lib_deps = [ + rt_dep +] -lib_incs = [] -lib_incs += include_directories('') +lib_incs = [ + include_directories('') +] -lib_srcs = [] -lib_srcs += join_paths('src', 'lfrtm.c') +lib_srcs = [ + join_paths('src', 'lfrtm.c') +] lfrtm = declare_dependency( include_directories : lib_incs, dependencies : lib_deps, sources : lib_srcs) -test_deps = [] -test_deps += lfrtm -test_deps += thread_dep +if build_tests + thread_dep = dependency('threads') + + test_deps = [ + lfrtm, + thread_dep + ] -test_srcs = [] -test_srcs += join_paths('test', 'test.c') + test_srcs = [ + join_paths('test', 'test.c') + ] -lfrtm_test = executable('lfrtm_test', test_srcs, - dependencies : test_deps, - install : false) + test_lfrtm = executable('test_lfrtm', test_srcs, + dependencies : test_deps, + install : false) -test(' 1 threads', lfrtm_test, - args : ['1'], - timeout : 240) -test(' 2 threads', lfrtm_test, - args : ['2'], - timeout : 240) -test(' 4 threads', lfrtm_test, - args : ['4'], - timeout : 240) -test(' 8 threads', lfrtm_test, - args : ['8'], - timeout : 240) -test('16 threads', lfrtm_test, - args : ['16'], - timeout : 240) -test('32 threads', lfrtm_test, - args : ['32'], - timeout : 240) + test(' 1 threads', test_lfrtm, + args : ['1'], + timeout : 240) + test(' 2 threads', test_lfrtm, + args : ['2'], + timeout : 240) + test(' 4 threads', test_lfrtm, + args : ['4'], + timeout : 240) + test(' 8 threads', test_lfrtm, + args : ['8'], + timeout : 240) + test('16 threads', test_lfrtm, + args : ['16'], + timeout : 240) + test('32 threads', test_lfrtm, + args : ['32'], + timeout : 240) -if reuse.found() - test('REUSE', reuse, args : [ - '--root', meson.current_source_dir(), - 'lint' - ]) + if reuse.found() + test('REUSE', reuse, args : [ + '--root', meson.current_source_dir(), + 'lint' + ]) + endif endif diff --git a/meson_options.txt b/meson_options.txt index c7412df6..dc21a480 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,8 @@ # SPDX-FileCopyrightText: Hanspeter Portner # SPDX-License-Identifier: CC0-1.0 +option('build-tests', + type : 'boolean', + value : true) + option('version', type : 'string', value : '0.1.57') -- 2.38.5