From 10eada3c6b9ee8dd6dd9c89030296817183ca8bf Mon Sep 17 00:00:00 2001 From: Slava Semushin Date: Sat, 3 Dec 2022 22:33:51 +0700 Subject: [PATCH] ci: migrate checking by ansible-lint from TravisCI to GitHub Actions Part of #1154 --- .github/workflows/static-analysis.yml | 14 ++++++++++ .travis.yml | 4 +-- docs/external-dependencies.md | 2 +- src/main/scripts/ci/check-build-and-verify.sh | 26 ++----------------- 4 files changed, 18 insertions(+), 28 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 6662ff9a6..39fc20ab3 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -142,6 +142,20 @@ jobs: run: pip3 install --user html5validator==0.4.2 - name: Run html5validator run: ./src/main/scripts/execute-command.sh html5validator + run-ansible-lint: + name: Run ansible-lint + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on + runs-on: ubuntu-20.04 + steps: + - name: Clone source code + uses: actions/checkout@v3.1.0 # https://github.com/actions/checkout + with: + # Whether to configure the token or SSH key with the local git config. Default: true + persist-credentials: false + - name: Install ansible-lint + run: pip3 install --user ansible-lint==4.2.0 + - name: Run ansible-lint + run: ./src/main/scripts/execute-command.sh ansible-lint run-enforcer: name: Run maven-enforcer-plugin # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on diff --git a/.travis.yml b/.travis.yml index a33276b69..489a18825 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,9 +24,7 @@ before_script: sudo apt-get -qq update; sudo apt-get install -y python3.6 python3-pip; curl https://bootstrap.pypa.io/pip/3.6/get-pip.py | sudo -H python3.6; - pip3 install --user \ - ansible==2.9.2 \ - ansible-lint==4.2.0; + pip3 install --user ansible==2.9.2; if [ "$TRAVIS_PULL_REQUEST" != 'false' ]; then gem install danger:8.2.2 nokogiri:1.10.10 --no-document; fi; diff --git a/docs/external-dependencies.md b/docs/external-dependencies.md index 8caf93093..6a6c24162 100644 --- a/docs/external-dependencies.md +++ b/docs/external-dependencies.md @@ -6,7 +6,7 @@ | JDK | OracleJDK 8u151 | Adopt OpenJDK 8u292 | OpenJDK 8u121-jre on Debian 8.11 (Jessy) | | MySQL | 5.7.27 | | 5.7.20 on Debian 8.11 (Jessy) | | PostgreSQL | | | 11.3 on Debian 9.13 (Stretch) | -| Python | 2.7.12, 3.5.2 | | | +| Python | 2.7.12, 3.5.2 | 3.8.10 | | | bash | 4.3.14 | | | | duplicity | 0.7.06 | | | | maven | | 3.8.6 | | diff --git a/src/main/scripts/ci/check-build-and-verify.sh b/src/main/scripts/ci/check-build-and-verify.sh index 5707a639d..7a6ea1f44 100755 --- a/src/main/scripts/ci/check-build-and-verify.sh +++ b/src/main/scripts/ci/check-build-and-verify.sh @@ -59,7 +59,6 @@ if [ "${1:-}" = '--only-integration-tests' ]; then fi VERIFY_STATUS= -ANSIBLE_LINT_STATUS= DANGER_STATUS=skip if [ "${SPRING_PROFILES_ACTIVE:-}" = 'travis' ] && [ "${TRAVIS_PULL_REQUEST:-false}" != 'false' ]; then @@ -67,7 +66,6 @@ if [ "${SPRING_PROFILES_ACTIVE:-}" = 'travis' ] && [ "${TRAVIS_PULL_REQUEST:-fal fi VERIFY_TIME=0 -ANSIBLE_LINT_TIME=0 DANGER_TIME=0 CURDIR="$(dirname "$0")" @@ -88,15 +86,6 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then MODIFIED_FILES="$(git --no-pager diff --name-only "$TRAVIS_COMMIT_RANGE" -- 2>/dev/null || :)" if [ -n "$MODIFIED_FILES" ]; then - AFFECTS_TRAVIS_CFG="$(echo "$MODIFIED_FILES" | grep -Fxq '.travis.yml' || echo 'no')" - AFFECTS_PLAYBOOKS="$(echo "$MODIFIED_FILES" | grep -Eq '(vagrant|prod|deploy|bootstrap|/roles/.+)\.yml$' || echo 'no')" - - if [ "$AFFECTS_TRAVIS_CFG" = 'no' ]; then - if [ "$AFFECTS_PLAYBOOKS" = 'no' ]; then - ANSIBLE_LINT_STATUS=skip - fi - fi - echo 'INFO: Some checks could be skipped' else echo "INFO: Couldn't determine list of modified files." @@ -108,13 +97,6 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then fi echo - - if [ "$ANSIBLE_LINT_STATUS" != 'skip' ]; then - START_TIME=$SECONDS - "$EXEC_CMD" ansible-lint >ansible_lint.log 2>&1 || ANSIBLE_LINT_STATUS=fail - ANSIBLE_LINT_TIME=$((SECONDS - START_TIME)) - fi - print_status "$ANSIBLE_LINT_STATUS" $ANSIBLE_LINT_TIME 'Run Ansible Lint' fi START_TIME=$SECONDS @@ -131,18 +113,14 @@ if [ "$DANGER_STATUS" != 'skip' ]; then fi print_status "$DANGER_STATUS" "$DANGER_TIME" 'Run danger' -if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then - [ "$ANSIBLE_LINT_STATUS" = 'skip' ] || print_log ansible_lint.log 'Run Ansible Lint' -fi - print_log verify.log 'Run integration tests' if [ "$DANGER_STATUS" != 'skip' ]; then print_log danger.log 'Run danger' fi -rm -f verify.log danger.log ansible_lint.log +rm -f verify.log danger.log -if echo "$VERIFY_STATUS$DANGER_STATUS$ANSIBLE_LINT_STATUS" | grep -Fqs 'fail'; then +if echo "$VERIFY_STATUS$DANGER_STATUS" | grep -Fqs 'fail'; then exit 1 fi