diff --git a/.fprettify.ini b/.fprettify.ini index 424aac784..25d1473bd 100644 --- a/.fprettify.ini +++ b/.fprettify.ini @@ -9,3 +9,8 @@ whitespace = 2 enable-decl = true enable-replacements = true c-relations = true + +# Hack to stop fprettify formatting CUDA-style chevrons from <<< to < < < +# We just ignore all files calling kernels: +# TODO delete me when relevant PR for fprettify is merged: https://github.com/pseewald/fprettify/pull/162 +exclude = ["exec_dist.f90"] diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1e20c5c94..00b61cf63 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,7 +1,10 @@ name: Run unit tests on: - push: + pull_request: + paths: + - 'src/**' + - 'tests/**' jobs: unit-tests: @@ -10,7 +13,7 @@ jobs: OMPI_VERSION: 4.1.5 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # We don't want to build openmpi each time this workflow is # run. Setup caching of OpenMPI after it is built and installed. @@ -18,7 +21,7 @@ jobs: # actions docs. - name: Cache OpenMPI id: cache-openmpi - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: openmpi-${{ env.OMPI_VERSION }}/installed key: openmpi-${{ env.OMPI_VERSION }} diff --git a/.github/workflows/check_commit_messages.sh b/.github/workflows/check_commit_messages.sh deleted file mode 100644 index 49a535a6d..000000000 --- a/.github/workflows/check_commit_messages.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -BASE_REF=$1 -REF=$2 - -for commit in $(git rev-list $BASE_REF..$REF) -do - echo "Checking commit $commit" - git cat-file commit $commit | sed '1,/^$/d' | python githooks/commit-msg -done diff --git a/.github/workflows/check_policies.yml b/.github/workflows/check_policies.yml index 6af9e9462..892ef34b0 100644 --- a/.github/workflows/check_policies.yml +++ b/.github/workflows/check_policies.yml @@ -1,24 +1,17 @@ name: check-policies -on: [push] + +on: [pull_request] + jobs: - check-commit-messages: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - # Checkout with full history, not just latest revision. - fetch-depth: 0 - - uses: actions/setup-python@v4 - - run: | - bash .github/workflows/check_commit_messages.sh \ - ${{ github.event.before }} ${{ github.event.after }} check-formatting: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v4 - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' - run: pip install fprettify - run: fprettify --config .fprettify.ini --diff --recursive src - - run: test -z "$($FPRETTIFY_COMMAND)" + - run: if [[ ! -z "$($FPRETTIFY_COMMAND)" ]]; then echo "::warning::Code formatting issues detected. See log for details."; fi env: FPRETTIFY_COMMAND: fprettify --config .fprettify.ini --diff --recursive src