Merge pull request #6547 from hristog/ci-workflow-roc-comment-changes

Update CI workflow to not run tests when only roc comments changed
This commit is contained in:
Richard Feldman 2024-03-04 11:10:31 -05:00 committed by GitHub
commit 8a170efa9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,10 +31,24 @@ jobs:
id: check_rs_comments
run: |
git fetch origin ${{ github.base_ref }}
if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -qvE '(\.md$|\.css$|\.html$|^AUTHORS$|\.rs)'; then
if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -qvE '(\.md$|\.css$|\.html$|^AUTHORS$|\.rs|\.roc)'; then
echo "should_run_tests=y" >> $GITHUB_OUTPUT
else
if git diff --unified=0 origin/${{ github.base_ref }} HEAD '*.rs' | grep -E --color=never '^[+-]' | grep -qvE '^(\+\+\+|\-\-\-|[+-]\s*($|\/\/|[+-]|\/\*.*\*\/\s*$))'; then
if git diff --unified=0 origin/${{ github.base_ref }} HEAD '*.rs' | grep -E --color=never '^[+-]' | grep -qvE '^(\+\+\+|\-\-\-|[+-]\s*($|\/\/|\/\*.*\*\/\s*$))'; then
echo "should_run_tests=y" >> $GITHUB_OUTPUT
else
echo "should_run_tests=n" >> $GITHUB_OUTPUT
fi
fi
- name: Check if only comments changed in roc files
id: check_roc_comments
run: |
git fetch origin ${{ github.base_ref }}
if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -qvE '(\.md$|\.css$|\.html$|^AUTHORS$|\.rs|\.roc)'; then
echo "should_run_tests=y" >> $GITHUB_OUTPUT
else
if git diff --unified=0 origin/${{ github.base_ref }} HEAD '*.roc' | grep -E --color=never '^[+-]' | grep -qvE '^(\+\+\+|\-\-\-|[+-]\s*($|#))'; then
echo "should_run_tests=y" >> $GITHUB_OUTPUT
else
echo "should_run_tests=n" >> $GITHUB_OUTPUT
@ -48,7 +62,11 @@ jobs:
if [ ${{ steps.check_rs_comments.outputs.should_run_tests }} = "y" ]; then
echo "run_tests=full" >> $GITHUB_OUTPUT
else
echo "run_tests=none" >> $GITHUB_OUTPUT
if [ ${{ steps.check_roc_comments.outputs.should_run_tests }} = "y" ]; then
echo "run_tests=full" >> $GITHUB_OUTPUT
else
echo "run_tests=none" >> $GITHUB_OUTPUT
fi
fi
else
echo "run_tests=none" >> $GITHUB_OUTPUT
@ -122,7 +140,7 @@ jobs:
needs: [check-changes]
if: needs.check-changes.outputs.run_tests == 'none'
steps:
- run: echo "Only non-code files changed and/or rs comment lines changed. CI manager did not run any workflows."
- run: echo "Only non-code files changed and/or rs and/or roc comment lines changed. CI manager did not run any workflows."
# we need a single end job for the required checks under branch protection rules
finish: