Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub actions workflows for unit testing, checking formatting, and updating actions #2

Merged
merged 5 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
40 changes: 40 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and test

on:
merge_group:
pull_request:
push:
branches: [main]

jobs:
build-and-test:
strategy:
matrix:
buildtype: [debug, release]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Update apt repositories for ccache
run: sudo apt update
- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ccache-linux-${{ matrix.buildtype }}
- name: Setup compiler and build tools
run: sudo apt install --no-install-recommends --yes g++-12 meson ninja-build
- name: Configure
run: |
CXX="ccache g++-12" meson setup \
--buildtype ${{ matrix.buildtype }} \
--warnlevel 3 \
--werror \
-Dcatch2:werror=false \
-Dcli11:werror=false \
-Dfmt:werror=false \
-Dnlohmann_json:werror=false \
-Dsqlite3:werror=false \
msimberg marked this conversation as resolved.
Show resolved Hide resolved
build .
- name: Build
run: ninja -C build
- name: Test
run: ./build/unit
17 changes: 17 additions & 0 deletions .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: clang-format

on:
merge_group:
pull_request:
push:
branches: [main]

jobs:
formatting-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check formatting
uses: jidicula/clang-format-action@v4.13.0
with:
clang-format-version: '14' # TODO?
msimberg marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 4 additions & 2 deletions src/cli/start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ void start_help() {
fmt::println("start help");
}

void start_args::add_cli(CLI::App& cli, global_settings& settings) {
void start_args::add_cli(CLI::App& cli,
[[maybe_unused]] global_settings& settings) {
msimberg marked this conversation as resolved.
Show resolved Hide resolved
auto* start_cli = cli.add_subcommand("start", "start a uenv session");
start_cli->add_option("-v,--view", view_description,
"comma separated list of views to load");
Expand All @@ -33,7 +34,8 @@ void start_args::add_cli(CLI::App& cli, global_settings& settings) {
start_cli->callback([&settings]() { settings.mode = uenv::mode_start; });
}

int start(const start_args& args, const global_settings& globals) {
int start(const start_args& args,
[[maybe_unused]] const global_settings& globals) {
fmt::println("running start with options {}", args);
const auto env =
concretise_env(args.uenv_description, args.view_description);
Expand Down
3 changes: 3 additions & 0 deletions src/uenv/lex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@ class lexer_impl {
++stream_;
return;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
case 'a' ... 'z':
case 'A' ... 'Z':
case '0' ... '9':
#pragma GCC diagnostic pop
msimberg marked this conversation as resolved.
Show resolved Hide resolved
case '_':
token_ = symbol();
return;
Expand Down
2 changes: 2 additions & 0 deletions src/util/expected.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

// clang-format off

msimberg marked this conversation as resolved.
Show resolved Hide resolved
// Taken from https://github.com/eth-cscs/arbor, https://arbor-sim.org/
/*
Copyright 2016-2020 Eidgenössische Technische Hochschule Zürich and
Expand Down
3 changes: 2 additions & 1 deletion test/unit/envvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ TEST_CASE("envvarset get final values", "[envvars]") {
ev.update_prefix_path("C", {uenv::update_kind::append, {"c", "d"}});

{
auto getenv = [](const std::string& name) -> const char* {
auto getenv =
[]([[maybe_unused]] const std::string& name) -> const char* {
return nullptr;
};
REQUIRE_THAT(ev.get_values(getenv),
Expand Down