https://gcc.gnu.org/g:62331e8c351962a557bd6dc4ed3787aaca444ac1
commit r16-4503-g62331e8c351962a557bd6dc4ed3787aaca444ac1 Author: Christophe Lyon <[email protected]> Date: Mon Sep 1 15:51:33 2025 +0000 top-level: Add forgejo sanity checks Add a sample workflow for Forgejo, as an example of integrated CI. To keep it lightweight, we run only two small checks on each patch of the series: - contrib/check_GNU_style.py which catches common mistakes (spaces vs tab, missing spaces, ...) but has some false positive warnings. - contrib/gcc-changelog/git_check_commit.py which checks the commit message and ChangeLog entry In order to run both checks even if the other fails, we use two steps with 'continue-on-error: true', and we need a 'final-result' consolidation step to generate the global status. ChangeLog: * .forgejo/workflows/sanity-checks.yaml: New file. Diff: --- .forgejo/workflows/sanity-checks.yaml | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/.forgejo/workflows/sanity-checks.yaml b/.forgejo/workflows/sanity-checks.yaml new file mode 100644 index 000000000000..361c497e9905 --- /dev/null +++ b/.forgejo/workflows/sanity-checks.yaml @@ -0,0 +1,49 @@ +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + testjob: + runs-on: sourceware-runner + outputs: + styleoutput: ${{ steps.check_gnu_style.outputs.styleresult }} + verifyoutput: ${{ steps.gcc_verify.outputs.verifyresult }} + steps: + - name: install dependencies + run: | + echo "Installing node.js" + apt-get update + apt-get install -qq -y nodejs git python3 python3-git python3-termcolor python3-unidiff + + # Checkout GCC sources, request an history depth of 100, + # hopefully sufficient for all patch series (the default is 1) + - uses: actions/checkout@v4 + with: + fetch-depth: 100 + + - name: check GNU style + id: check_gnu_style + continue-on-error: true + run: | + echo "Running check_GNU_style.py" + git fetch origin ${FORGEJO_BASE_REF}:${FORGEJO_BASE_REF} + for sha in $(git rev-list ${FORGEJO_BASE_REF}..${FORGEJO_SHA}) + do + echo "Checking GNU style for $sha" + git show $sha | ./contrib/check_GNU_style.py - + done + echo "styleresult=pass" | tee -a $FORGEJO_OUTPUT + + - name: gcc-verify + id: gcc_verify + continue-on-error: true + run: | + echo "Running gcc-verify check" + ./contrib/gcc-changelog/git_check_commit.py ${FORGEJO_BASE_REF}..${FORGEJO_SHA} + echo "verifyresult=pass" | tee -a $FORGEJO_OUTPUT + + - name: final-result + run: | + echo "Computing final result" + test "${{ steps.check_gnu_style.outputs.styleresult }}" = "pass" + test "${{ steps.gcc_verify.outputs.verifyresult }}" = "pass"
