From a836a244a3d2bdd4da1ee2641e3e957850668cea Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 8 May 2023 18:27:04 +0200 Subject: Adding upstream version 1.39.0. Signed-off-by: Daniel Baumann --- .github/workflows/review.yml | 85 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 2 deletions(-) (limited to '.github/workflows/review.yml') diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index 7f12aeecd..5756e4b21 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -1,5 +1,5 @@ --- -# Runs various ReviewDog based checks against PR with suggested changes to improve quality +# Runs various linter checks against PR with suggested changes to improve quality name: Review on: pull_request: @@ -15,7 +15,9 @@ jobs: runs-on: ubuntu-latest outputs: actionlint: ${{ steps.actionlint.outputs.run }} + clangformat: ${{ steps.clangformat.outputs.run }} eslint: ${{ steps.eslint.outputs.run }} + flake8: ${{ steps.flake8.outputs.run }} hadolint: ${{ steps.hadolint.outputs.run }} shellcheck: ${{ steps.shellcheck.outputs.run }} yamllint: ${{ steps.yamllint.outputs.run }} @@ -36,6 +38,17 @@ jobs: else echo "run=false" >> "${GITHUB_OUTPUT}" fi + - name: Check files for clang-format + id: clangformat + run: | + if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/clang-format') }}" = "true" ]; then + echo "run=true" >> "${GITHUB_OUTPUT}" + elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '\.cpp$|\.cxx$|\.c$|\.hpp$|\.hxx$|\.h$' ; then + echo "run=true" >> "${GITHUB_OUTPUT}" + echo 'C/C++ code has changed, need to run clang-format.' + else + echo "run=false" >> "${GITHUB_OUTPUT}" + fi - name: Check files for eslint id: eslint run: | @@ -47,6 +60,17 @@ jobs: else echo "run=false" >> "${GITHUB_OUTPUT}" fi + - name: Check files for flake8 + id: flake8 + run: | + if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/flake8') }}" = "true" ]; then + echo "run=true" >> "${GITHUB_OUTPUT}" + elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.py' ; then + echo "run=true" >> "${GITHUB_OUTPUT}" + echo 'Python files have changed, need to run flake8.' + else + echo "run=false" >> "${GITHUB_OUTPUT}" + fi - name: Check files for hadolint id: hadolint run: | @@ -98,6 +122,39 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} reporter: github-pr-check + clang-format: + name: clang-format + needs: prep-review + if: needs.prep-review.outputs.clangformat == 'true' + runs-on: ubuntu-latest + steps: + - name: Git clone repository + uses: actions/checkout@v3 + with: + submodules: false + fetch-depth: 0 + - name: Check for label + id: label + run: | + if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/clang-format') }}" = "true" ]; then + echo 'check-all=true' >> "${GITHUB_OUTPUT}" + else + echo 'check-all=false' >> "${GITHUB_OUTPUT}" + fi + - name: Run clang-format + run: | + if [ "${{ steps.label.outputs.check-all }}" == 'true' ]; then + find . -regex '.*\.\(c\|cpp\|cxx\|h\|hpp\|hxx\)$' -exec clang-format -i --style=file '{}' \; + else + git diff --name-only origin/${{ github.base_ref }} HEAD | grep -E '\.cpp$|\.cxx$|\.c$|\.hpp$|\.hxx$|\.h$' | \ + xargs -n 1 -r clang-format -i --style=file + fi + git status --porcelain=v1 > /tmp/porcelain + if [ -s /tmp/porcelain ]; then + cat /tmp/porcelain + exit 1 + fi + eslint: name: eslint needs: prep-review @@ -118,6 +175,27 @@ jobs: reporter: github-pr-check eslint_flags: '.' + flake8: + name: flake8 + needs: prep-review + if: needs.prep-review.outputs.flake8 == 'true' + runs-on: ubuntu-latest + steps: + - name: Git clone repository + uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Run flake8 + uses: reviewdog/action-flake8@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + reporter: github-pr-check + hadolint: name: hadolint needs: prep-review @@ -152,7 +230,10 @@ jobs: reporter: github-pr-check path: "." pattern: "*.sh*" - exclude: "./.git/*" + exclude: | + ./.git/* + packaging/makeself/makeself.sh + packaging/makeself/makeself-header.sh yamllint: name: yamllint -- cgit v1.2.3