aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Horman <nhorman@openssl.org>2024-07-08 08:32:29 -0400
committerNeil Horman <nhorman@openssl.org>2024-07-10 08:32:31 -0400
commite04a00f7cdeda4c0bee0e0031df7a51d9e224795 (patch)
tree8410aa119c9338342ef245b632e9052394a1ad82
parent548469f55f288502d5d4ebdf0b480fa8d8b37102 (diff)
downloadopenssl-openssl-3.0.zip
openssl-openssl-3.0.tar.gz
openssl-openssl-3.0.tar.bz2
Add a style-check workflowopenssl-3.0
Add a CI job that evaluates style issues, restricted only to lines changed for the affected files in a given commit Also provide a mechanism to waive those style issues. by applying the style:exempted label to a PR, the checks are still run (its nice to see what they are regardless), but the test will pass CI regardless of weather any issues are found. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/24806) (cherry picked from commit fc22d74c53720d14f99fd880b767d8a3e4986ae2)
-rw-r--r--.github/workflows/style-checks.yml55
1 files changed, 55 insertions, 0 deletions
diff --git a/.github/workflows/style-checks.yml b/.github/workflows/style-checks.yml
new file mode 100644
index 0000000..7ed843f
--- /dev/null
+++ b/.github/workflows/style-checks.yml
@@ -0,0 +1,55 @@
+# Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the Apache License 2.0 (the "License"). You may not use
+# this file except in compliance with the License. You can obtain a copy
+# in the file LICENSE in the source distribution or at
+# https://www.openssl.org/source/license.html
+
+name: Coding style validation
+
+on: [pull_request]
+
+env:
+ PR_NUMBER: ${{ github.event.number }}
+ GH_TOKEN: ${{ github.token }}
+
+permissions:
+ contents: read
+
+jobs:
+ check-style:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ path: openssl
+ - name: check style for each commit
+ working-directory: openssl
+ shell: bash
+ run: |
+ ERRORS_FOUND=0
+ git fetch origin $GITHUB_BASE_REF:$GITHUB_BASE_REF
+ REFSTART=$(git rev-parse $GITHUB_BASE_REF)
+ REFEND=$(git rev-parse HEAD)
+ echo "Checking from $REFSTART to $REFEND"
+ for i in $(git log --no-merges --format=%H $REFSTART..$REFEND)
+ do
+ echo "::group::Style report for commit $i"
+ set +e
+ ./util/check-format-commit.sh $i
+ if [ $? -ne 0 ]
+ then
+ ERRORS_FOUND=1
+ fi
+ set -e
+ echo "::endgroup::"
+ done
+ SKIP_TEST=$(gh pr view $PR_NUMBER --json labels --jq '.labels[] | select(.name == "style: waived") | .name')
+ if [ -z "$SKIP_TEST" ]
+ then
+ exit $ERRORS_FOUND
+ else
+ echo "PR $PR_NUMBER is marked with style: waived, waiving style check errors"
+ exit 0
+ fi