Skip to content

Add test for partial derivatives #52

Add test for partial derivatives

Add test for partial derivatives #52

name: Static Analyses
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
merge_group:
types: [checks_requested]
# Cancel old static analyses if new pushes are added to the branch
concurrency:
group: ${{ github.workflow }}-${{ github.action.number }}
cancel-in-progress: true
jobs:
Indentation:
name: Clang Formatting Check
runs-on: ubuntu-latest
container:
image: ghcr.io/gyselax/gyselalibxx_env
options: --user 1001
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
./bin/indent -td
Markdown:
name: Markdown format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Get Python dependencies
run: |
pip install numpy
- name: Check files
id: markdown
shell: bash
run: |
MARKDOWN_FILES=$(find . -name "*.md" -not -path "./vendor/*")
MARKDOWN_FILES="$MARKDOWN_FILES $(find ./vendor/sll/ -name '*.md')"
echo $MARKDOWN_FILES
python3 ci_tools/markdown_linter.py ${MARKDOWN_FILES}
Python:
name: Python Best Practices
runs-on: ubuntu-latest
container:
image: ghcr.io/gyselax/gyselalibxx_env
options: --user 1001
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run pylint
run: |
pylint $(find tests -iname *.py)
pylint $(find doc -iname *.py)
pylint $(find ci_tools -iname *.py)
shell: bash
env:
PYTHONPATH: ./post-process/PythonScripts
- name: Run filtered pylint
run: |
# Find all files with no extension or a .py extension in post-process/PythonScripts/
POST_PROCESS_PYTHON_FILES=$(find post-process/PythonScripts/ -type f ! -name "*.*"; find post-process/PythonScripts -iname *.py)
# Get pylint errors without failing
pylint ${POST_PROCESS_PYTHON_FILES} > post_process_errors.txt || true
# Filter errors on changed files
for f in $(git diff ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }} --name-only)
do
grep $f post_process_errors.txt || true
done | tee filtered_errors.txt
# Raise an error if post-process in filtered errors
! grep "post-process" filtered_errors.txt >/dev/null
shell: bash
env:
PYTHONPATH: ./post-process/PythonScripts
Documentation:
name: Documentation check
runs-on: ubuntu-latest
container:
image: ghcr.io/gyselax/gyselalibxx_env
options: --user 1001
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Make documenation
run: |
# Make docs
cmake -DGYSELALIBXX_COMPILE_SOURCE=OFF -DGYSELALIBXX_BUILD_DOCUMENTATION=ON -B build -S .
cmake --build build --target doc
shell: bash
- name: Check for new errors
run: |
# Get files which have changed in this merge request
git diff ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}..${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} --no-indent-heuristic --unified=0 --output=pull_diff.txt --no-color
# Filter documentation messages to only complain about modified files
python3 ci_tools/check_documentation.py pull_diff.txt build/docs/doxygen.log
git diff ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}..${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} --no-indent-heuristic --unified=0 --output=pull_new_files.txt --no-color --diff-filter=A
python3 ci_tools/check_readme_presence.py pull_new_files.txt
shell: bash
cppcheck_static_analysis_errors:
name: CppCheck static analysis errors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- uses: ./.github/actions/linux_static_analysis_install
- uses: ./.github/actions/python-static-analysis-setup
- uses: ./.github/actions/test_filter
with:
base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
trigger_type: ${{ github.event_name }}
- run: |
python3 ci_tools/gyselalib_static_analysis.py ${CHANGED_FILES} --errors-only
cppcheck_static_analysis_warnings:
name: CppCheck static analysis warnings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- uses: ./.github/actions/linux_static_analysis_install
- uses: ./.github/actions/python-static-analysis-setup
- uses: ./.github/actions/test_filter
with:
base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
trigger_type: ${{ github.event_name }}
- run: |
python3 ci_tools/gyselalib_static_analysis.py ${CHANGED_FILES}
cmake_static_analysis:
name: CMake static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- run: |
python3 ci_tools/cmake_checker.py
set_draft_failing:
runs-on: ubuntu-latest
needs: [Indentation, Markdown, Python, Documentation, cppcheck_static_analysis_errors, cmake_static_analysis]
if: github.event_name == 'pull_request' && failure()
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Set PR to draft to avoid unnecessary runs
run: |
isDraft=$(gh pr view ${{ github.event.pull_request.number }} --json isDraft | jq ."isDraft")
if [[ "${isDraft}" != "true" ]]
then
gh pr ready ${{ github.event.pull_request.number }} --undo
gh pr comment ${{ github.event.pull_request.number }} -b "This PR is failing tests so it has been put back into draft. Please remove the draft status when the tests pass."
gh pr edit ${{ github.event.pull_request.number }} --remove-label "Ready to review"
fi
shell: bash
env:
GH_TOKEN: ${{ github.token }}