Skip to content

Commit

Permalink
UGRID-7: Update GitHub actions (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmad-el-sayed authored Jul 30, 2024
1 parent d6e58a3 commit 05f30e8
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 37 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ IndentWidth: 4
TabWidth: 4
BreakBeforeBraces: Allman
AllowShortIfStatementsOnASingleLine: false
AllowShortLambdasOnASingleLine: Inline
IndentCaseLabels: false
ColumnLimit: 0
AccessModifierOffset: -4
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/doxy-build.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
name: DoxygenDeploy
name: Deploy documentation

on:
push:
branches: [main]

jobs:
check:
runs-on: ubuntu-20.04
name: DoxygenDeploy

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11

- name: Install doxygen
run: sudo apt-get install doxygen

Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/doxy-check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: DoxygenCheck
name: Check documentation

on:
push:
Expand All @@ -7,13 +7,17 @@ on:

jobs:
check:
runs-on: ubuntu-20.04
name: DoxygenCheck

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11

- name: Install doxygen
run: sudo apt-get install doxygen

Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Codespell
name: Spell check

on:
push:
Expand All @@ -7,10 +7,14 @@ on:

jobs:
check:
runs-on: ubuntu-20.04
name: Codespell

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: codespell-project/actions-codespell@master
- uses: actions/checkout@v4

- uses: codespell-project/actions-codespell@v2
with:
check_filenames: true
skip: tests,extern,build,.git,.gitignore,*.tif,*.ppt,*.pdf,*.jpg,*.cd
check_hidden: false
36 changes: 20 additions & 16 deletions .github/workflows/style-check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ClangFormat
name: Code formatting

on:
push:
Expand All @@ -7,26 +7,30 @@ on:

jobs:
check:
runs-on: ubuntu-20.04
name: ClangFormat

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download a recent, static build of clang-format
run: |
wget --no-verbose https://github.com/angular/clang-format/raw/master/bin/linux_x64/clang-format
chmod a+x clang-format
- name: Print clang-format version
run: |
./clang-format --version
- uses: actions/checkout@v4

- name: Install clang-format
run: sudo apt install clang-format

- name: Run clang-format and report result
run: |
cd src
declare -a directories=("src" "include" "tests")
# Parse full lines
export IFS=$'\n'
# For each file in repository with name ending with ".hpp", ".h", ".cpp" ...
for file in $(git ls-files | egrep "\\.hpp$|\\.h$|\\.cpp$"$); do
echo Formatting "$file"
# format it in place, so git can pick it up.
../clang-format -style=file -i "$file"
for directory in "${directories[@]}"; do
(
cd "${directory}"
# Format each file in the directory with name ending with ".hpp", ".h", ".cpp"
for file in $(git ls-files | egrep "\\.hpp$|\\.h$|\\.cpp$"$); do
echo Formatting "${file}"
# format it in place, so git diff can pick it up.
clang-format -style=file -i "${file}"
done
)
done
# Just some visual separation
echo -e "\\n\\n\\n\\tChecking diff...\\n\\n\\n"
Expand Down
5 changes: 4 additions & 1 deletion include/UGrid/Operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ namespace ugrid

static void right_trim_string(std::string& str)
{
auto const isalnum_lambda = [](auto const& ch) { return std::isalnum(ch); };
auto const isalnum_lambda = [](auto const& ch)
{
return std::isalnum(ch);
};
str.erase(std::find_if(str.rbegin(), str.rend(), isalnum_lambda).base(), str.end());
}

Expand Down
9 changes: 7 additions & 2 deletions src/UGrid/Mesh1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,20 @@

using ugrid::Mesh1D;

Mesh1D::Mesh1D(std::shared_ptr<netCDF::NcFile> nc_file) : UGridEntity(nc_file){};
Mesh1D::Mesh1D(std::shared_ptr<netCDF::NcFile> nc_file)
: UGridEntity(nc_file)
{
}

Mesh1D::Mesh1D(
std::shared_ptr<netCDF::NcFile> nc_file,
netCDF::NcVar const& topology_variable,
std::map<std::string, std::vector<netCDF::NcVar>> const& entity_attributes,
std::map<std::string, std::vector<std::string>> const& entity_attribute_names,
std::map<UGridFileDimensions, netCDF::NcDim> const& entity_dimensions)
: UGridEntity(nc_file, topology_variable, entity_attributes, entity_attribute_names, entity_dimensions){};
: UGridEntity(nc_file, topology_variable, entity_attributes, entity_attribute_names, entity_dimensions)
{
}

void Mesh1D::define(ugridapi::Mesh1D const& mesh1d)
{
Expand Down
5 changes: 4 additions & 1 deletion tests/utils/include/TestUtils/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
/// @param str [in] The input string
static void right_trim_string(std::string& str)
{
auto const isalnum_lambda = [](auto const& ch) { return std::isalnum(ch); };
auto const isalnum_lambda = [](auto const& ch)
{
return std::isalnum(ch);
};
str.erase(std::find_if(str.rbegin(), str.rend(), isalnum_lambda).base(), str.end());
}

Expand Down

0 comments on commit 05f30e8

Please sign in to comment.