| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| name: "Shellcheck: POSIX conformity" |
| |
| on: |
| push: |
| pull_request: |
| |
| jobs: |
| shellcheck: |
| name: shellcheck |
| runs-on: ubuntu-latest |
| env: |
| SHELLCHECK_VERSION: '0.10.0' |
| # SC1091: Don't error about unfollowable files; https://www.shellcheck.net/wiki/SC1091 |
| # SC2009: Don't consider pgrep, not available everywhere; https://www.shellcheck.net/wiki/SC2009 |
| SHELLCHECK_OPTS: '-e SC1091 -e SC2009' |
| steps: |
| - uses: actions/checkout@v7 |
| - name: download |
| run: | |
| curl --silent --fail --show-error --retry 2 --retry-delay 1 --connect-timeout 5 --location --url "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" -o shellcheck-v${SHELLCHECK_VERSION}.tar.xz |
| tar xvf "shellcheck-v${SHELLCHECK_VERSION}.tar.xz" |
| rm -f "shellcheck-v${SHELLCHECK_VERSION}.tar.xz" |
| chmod +x "$GITHUB_WORKSPACE/shellcheck-v${SHELLCHECK_VERSION}/shellcheck" |
| - name: check |
| run: | |
| echo "$GITHUB_WORKSPACE/shellcheck-v${SHELLCHECK_VERSION}" >> $GITHUB_PATH |
| readarray -t SCRIPT_FILES < <(grep -ErIl -e '^#![[:blank:]]*/bin/(ba|da|c|k|z)?sh' -e '^#!/usr/bin/env[[:blank:]]+(ba|da|c|k|z)?sh' "$GITHUB_WORKSPACE/maven-wrapper-distribution/src/resources") |
| shellcheck \ |
| --source-path "$GITHUB_WORKSPACE/maven-wrapper-distribution/src/resources" \ |
| --format=gcc \ |
| "${SCRIPT_FILES[@]}" |