Skip to content

Commit

Permalink
Add linter check
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Lampacrescia <[email protected]>
  • Loading branch information
MarcoLm993 committed Jun 21, 2024
1 parent 2ba9b75 commit f3aa433
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 23 deletions.
47 changes: 25 additions & 22 deletions .github/workflows/build_executable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- "main"
- "add-clang-format-check"
tags:
- "[0-9]+.[0-9]+.[0-9]+"

Expand Down Expand Up @@ -61,6 +62,9 @@ jobs:
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -Dstorm_DIR=$STORM_BUILD_DIR
make
- name: run linting
run: |
./scripts/check-clang-style.bash
- name: Run tests
run: |
cd build
Expand Down Expand Up @@ -116,26 +120,25 @@ jobs:
retention-days: 10
overwrite: true


release:
needs: build
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifact
id: download-artifact
uses: actions/download-artifact@v4
with:
name: smc_storm_executable
- name: Generate tar file
run: |
cd ${{ steps.download-artifact.outputs.download-path }}
chmod +x install.sh
tar -czf smc_storm_executable.tar.gz *
- uses: softprops/action-gh-release@v2
with:
files: ${{ steps.download-artifact.outputs.download-path }}/smc_storm_executable.tar.gz
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
needs: build
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifact
id: download-artifact
uses: actions/download-artifact@v4
with:
name: smc_storm_executable
- name: Generate tar file
run: |
cd ${{ steps.download-artifact.outputs.download-path }}
chmod +x install.sh
tar -czf smc_storm_executable.tar.gz *
- uses: softprops/action-gh-release@v2
with:
files: ${{ steps.download-artifact.outputs.download-path }}/smc_storm_executable.tar.gz
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
19 changes: 19 additions & 0 deletions scripts/check-clang-style.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Get the path to the directory of script
CODE_ROOT=$(dirname $(dirname $(realpath "${BASH_SOURCE[0]}")))
# Move to the root of the project
pushd $CODE_ROOT > /dev/null || exit
# Apply clang-format to all source files

clang-tidy --config-file=.clang-tidy --warnings-as-errors=* -p=build src/**/*.cpp include/**/*.hpp **/*.cpp && \
clang-format --style=file src/**/*.cpp include/**/*.hpp test/*.cpp --dry-run --Werror

if [ $? -ne 0 ]; then
echo "Error: clang-tidy or clang-format failed"
popd > /dev/null
exit 1
fi
# Return to the original directory
popd > /dev/null
exit
2 changes: 1 addition & 1 deletion src/samples/sampling_results.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ bool SamplingResults::evaluateChowRobbinsBound() {
}

void SamplingResults::addBatchResults(const BatchResults& res) {
std::scoped_lock<std::mutex> lock(_mtx);
std::scoped_lock<std::mutex> Lock(_mtx);
_n_verified += res.n_verified;
_n_not_verified += res.n_not_verified;
_n_no_info += res.n_no_info;
Expand Down

0 comments on commit f3aa433

Please sign in to comment.