From d1e97c4b8ac0d680c67ab54490f9cf6685d4726c Mon Sep 17 00:00:00 2001 From: Jamie Quinn Date: Thu, 8 Feb 2024 16:02:26 +0000 Subject: [PATCH 1/9] Fix chevron issue by ignoring the entire file. Better than nothing. --- .fprettify.ini | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.fprettify.ini b/.fprettify.ini index 424aac784..ba0aeb6c2 100644 --- a/.fprettify.ini +++ b/.fprettify.ini @@ -9,3 +9,7 @@ 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: +exclude = ["exec_dist.f90"] From 7878dd330b63c24212a47f5b82d50bdeda7c5046 Mon Sep 17 00:00:00 2001 From: Jamie Quinn Date: Thu, 8 Feb 2024 16:47:51 +0000 Subject: [PATCH 2/9] Add comment to remove CUDA chevron hack when fprettify is fixed --- .fprettify.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/.fprettify.ini b/.fprettify.ini index ba0aeb6c2..25d1473bd 100644 --- a/.fprettify.ini +++ b/.fprettify.ini @@ -12,4 +12,5 @@ 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"] From 883b592e3507af3d1e8a872dc793775707643ca4 Mon Sep 17 00:00:00 2001 From: Jamie Quinn Date: Thu, 8 Feb 2024 16:56:54 +0000 Subject: [PATCH 3/9] Update github actions fprettify workflow to output a warning rather than an error --- .github/workflows/check_policies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_policies.yml b/.github/workflows/check_policies.yml index 6af9e9462..dfc92c79b 100644 --- a/.github/workflows/check_policies.yml +++ b/.github/workflows/check_policies.yml @@ -19,6 +19,6 @@ jobs: - uses: actions/checkout@v3 - 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"; fi env: FPRETTIFY_COMMAND: fprettify --config .fprettify.ini --diff --recursive src From 559d68b210c2399ddcf83df4c14163a60490bc68 Mon Sep 17 00:00:00 2001 From: Jamie Quinn Date: Thu, 8 Feb 2024 17:13:53 +0000 Subject: [PATCH 4/9] fix: Quote fprettify output --- .github/workflows/check_policies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_policies.yml b/.github/workflows/check_policies.yml index dfc92c79b..b358b1fb4 100644 --- a/.github/workflows/check_policies.yml +++ b/.github/workflows/check_policies.yml @@ -19,6 +19,6 @@ jobs: - uses: actions/checkout@v3 - run: pip install fprettify - run: fprettify --config .fprettify.ini --diff --recursive src - - run: if [ ! -z $($FPRETTIFY_COMMAND) ]; then echo "::warning::Code formatting issues detected"; fi + - run: if [[ ! -z "$($FPRETTIFY_COMMAND)" ]]; then echo "::warning::Code formatting issues detected"; fi env: FPRETTIFY_COMMAND: fprettify --config .fprettify.ini --diff --recursive src From 4c65010fb39e654afd864f39970bfe6f734f74d0 Mon Sep 17 00:00:00 2001 From: Jamie Quinn Date: Thu, 8 Feb 2024 17:22:32 +0000 Subject: [PATCH 5/9] Fix: Remove node.js warnings in GHA --- .github/workflows/check_policies.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check_policies.yml b/.github/workflows/check_policies.yml index b358b1fb4..5c119f118 100644 --- a/.github/workflows/check_policies.yml +++ b/.github/workflows/check_policies.yml @@ -4,21 +4,25 @@ jobs: check-commit-messages: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # Checkout with full history, not just latest revision. fetch-depth: 0 - uses: actions/setup-python@v4 + with: + python-version: '3.10' - run: | bash .github/workflows/check_commit_messages.sh \ ${{ github.event.before }} ${{ github.event.after }} check-formatting: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 - - uses: actions/checkout@v3 + with: + python-version: '3.10' - run: pip install fprettify - run: fprettify --config .fprettify.ini --diff --recursive src - - run: if [[ ! -z "$($FPRETTIFY_COMMAND)" ]]; then echo "::warning::Code formatting issues detected"; fi + - 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 From 0d761895b288c01ee1827c4fac6e801ecd2a1e0b Mon Sep 17 00:00:00 2001 From: Jamie Quinn Date: Thu, 8 Feb 2024 17:26:36 +0000 Subject: [PATCH 6/9] fix: update python action to remove nodejs error --- .github/workflows/check_policies.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_policies.yml b/.github/workflows/check_policies.yml index 5c119f118..3cef30c4d 100644 --- a/.github/workflows/check_policies.yml +++ b/.github/workflows/check_policies.yml @@ -8,7 +8,7 @@ jobs: with: # Checkout with full history, not just latest revision. fetch-depth: 0 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.10' - run: | @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.10' - run: pip install fprettify From 695f081502d6dc3f90a096b74774184e73a8675d Mon Sep 17 00:00:00 2001 From: Jamie Quinn Date: Thu, 8 Feb 2024 17:27:52 +0000 Subject: [PATCH 7/9] fix: update unit test action to remove nodejs error --- .github/workflows/build_and_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1e20c5c94..ca81f0a9f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -10,7 +10,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 +18,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 }} From a93b9050b4d2f81b6ff073f9f96778789f0605f6 Mon Sep 17 00:00:00 2001 From: Jamie Quinn Date: Thu, 8 Feb 2024 17:33:08 +0000 Subject: [PATCH 8/9] Update schedule to only run GHA on pull requests (the unit tests specifically only run when src/** or tests/** change) --- .github/workflows/build_and_test.yml | 5 ++++- .github/workflows/check_policies.yml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index ca81f0a9f..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: diff --git a/.github/workflows/check_policies.yml b/.github/workflows/check_policies.yml index 3cef30c4d..2878fd622 100644 --- a/.github/workflows/check_policies.yml +++ b/.github/workflows/check_policies.yml @@ -1,5 +1,7 @@ name: check-policies -on: [push] + +on: [pull_request] + jobs: check-commit-messages: runs-on: ubuntu-latest @@ -14,6 +16,7 @@ jobs: - run: | bash .github/workflows/check_commit_messages.sh \ ${{ github.event.before }} ${{ github.event.after }} + check-formatting: runs-on: ubuntu-latest steps: From e455adc5dea8fd7460c61ce746a99ab3a60f1097 Mon Sep 17 00:00:00 2001 From: Jamie Quinn Date: Thu, 8 Feb 2024 17:33:28 +0000 Subject: [PATCH 9/9] Remove Conventional Commit constraint --- .github/workflows/check_commit_messages.sh | 10 ---------- .github/workflows/check_policies.yml | 14 -------------- 2 files changed, 24 deletions(-) delete mode 100644 .github/workflows/check_commit_messages.sh 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 2878fd622..892ef34b0 100644 --- a/.github/workflows/check_policies.yml +++ b/.github/workflows/check_policies.yml @@ -3,20 +3,6 @@ name: check-policies on: [pull_request] jobs: - check-commit-messages: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - # Checkout with full history, not just latest revision. - fetch-depth: 0 - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - run: | - bash .github/workflows/check_commit_messages.sh \ - ${{ github.event.before }} ${{ github.event.after }} - check-formatting: runs-on: ubuntu-latest steps: