Skip to content

Commit

Permalink
[C++] Add GitHub Actions setup
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Marr <[email protected]>
  • Loading branch information
smarr committed Jan 11, 2024
1 parent b0129d7 commit 30122e0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

jobs:
test_awfy:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -38,6 +38,9 @@ jobs:

- name: Python
id: python

- name: C++
id: cpp

name: ${{ matrix.name }}
steps:
Expand Down
15 changes: 9 additions & 6 deletions benchmarks/C++/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,31 @@ CMD_VERSION='-mp-17'

if ! [ -x "$(command -v clang++$CMD_VERSION)" ]; then
CMD_VERSION='-17'
if ! [ -x "$(command -v clang++$CMD_VERSION)" ]; then
CMD_VERSION='-15'
fi
fi

CMD="clang++$CMD_VERSION"

if [ "$1" = "format" ]
then
CMD=clang-format
type -P "$CMD" || CMD=clang-format$CMD_VERSION
CMD=clang-format$CMD_VERSION
type -P "$CMD" || CMD=clang-format
exec $CMD -i --style=file src/*.cpp src/*.h src/**/*.cpp src/**/*.h
fi

if [ "$1" = "check-format" ]
then
CMD=clang-format
type -P "$CMD" || CMD=clang-format$CMD_VERSION
CMD=clang-format$CMD_VERSION
type -P "$CMD" || CMD=clang-format
exec $CMD --style=file --dry-run --Werror src/*.cpp src/*.h src/**/*.cpp src/**/*.h
fi

if [ "$1" = "lint" ]
then
CMD=clang-tidy
type -P "$CMD" || CMD=clang-tidy$CMD_VERSION
CMD=clang-tidy$CMD_VERSION
type -P "$CMD" || CMD=clang-tidy
exec $CMD --config-file=.clang-tidy -header-filter=.* src/*.cpp
fi

Expand Down
22 changes: 22 additions & 0 deletions implementations/build-cpp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -e # make script fail on first error
SCRIPT_PATH=`dirname $0`
source $SCRIPT_PATH/script.inc

if [ "$1" = "style" ]
then
pushd $SCRIPT_PATH/../benchmarks/C++

INFO Check Format

./build.sh check-format
FMT_EXIT=$?

INFO Run Lint
./build.sh lint
LNT_EXIT=$?
exit $((FMT_EXIT + LNT_EXIT))
else
pushd $SCRIPT_PATH/../benchmarks/C++
exec ./build.sh
fi

0 comments on commit 30122e0

Please sign in to comment.