Skip to content

Commit 10eada3

Browse files
committed
ci: migrate checking by ansible-lint from TravisCI to GitHub Actions
Part of #1154
1 parent ed24277 commit 10eada3

File tree

4 files changed

+18
-28
lines changed

4 files changed

+18
-28
lines changed

.github/workflows/static-analysis.yml

+14
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,20 @@ jobs:
142142
run: pip3 install --user html5validator==0.4.2
143143
- name: Run html5validator
144144
run: ./src/main/scripts/execute-command.sh html5validator
145+
run-ansible-lint:
146+
name: Run ansible-lint
147+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
148+
runs-on: ubuntu-20.04
149+
steps:
150+
- name: Clone source code
151+
uses: actions/[email protected] # https://github.com/actions/checkout
152+
with:
153+
# Whether to configure the token or SSH key with the local git config. Default: true
154+
persist-credentials: false
155+
- name: Install ansible-lint
156+
run: pip3 install --user ansible-lint==4.2.0
157+
- name: Run ansible-lint
158+
run: ./src/main/scripts/execute-command.sh ansible-lint
145159
run-enforcer:
146160
name: Run maven-enforcer-plugin
147161
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on

.travis.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ before_script:
2424
sudo apt-get -qq update;
2525
sudo apt-get install -y python3.6 python3-pip;
2626
curl https://bootstrap.pypa.io/pip/3.6/get-pip.py | sudo -H python3.6;
27-
pip3 install --user \
28-
ansible==2.9.2 \
29-
ansible-lint==4.2.0;
27+
pip3 install --user ansible==2.9.2;
3028
if [ "$TRAVIS_PULL_REQUEST" != 'false' ]; then
3129
gem install danger:8.2.2 nokogiri:1.10.10 --no-document;
3230
fi;

docs/external-dependencies.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
| JDK | OracleJDK 8u151 | Adopt OpenJDK 8u292 | OpenJDK 8u121-jre on Debian 8.11 (Jessy) |
77
| MySQL | 5.7.27 | | 5.7.20 on Debian 8.11 (Jessy) |
88
| PostgreSQL | | | 11.3 on Debian 9.13 (Stretch) |
9-
| Python | 2.7.12, 3.5.2 | | |
9+
| Python | 2.7.12, 3.5.2 | 3.8.10 | |
1010
| bash | 4.3.14 | | |
1111
| duplicity | 0.7.06 | | |
1212
| maven | | 3.8.6 | |

src/main/scripts/ci/check-build-and-verify.sh

+2-24
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,13 @@ if [ "${1:-}" = '--only-integration-tests' ]; then
5959
fi
6060

6161
VERIFY_STATUS=
62-
ANSIBLE_LINT_STATUS=
6362

6463
DANGER_STATUS=skip
6564
if [ "${SPRING_PROFILES_ACTIVE:-}" = 'travis' ] && [ "${TRAVIS_PULL_REQUEST:-false}" != 'false' ]; then
6665
DANGER_STATUS=
6766
fi
6867

6968
VERIFY_TIME=0
70-
ANSIBLE_LINT_TIME=0
7169
DANGER_TIME=0
7270

7371
CURDIR="$(dirname "$0")"
@@ -88,15 +86,6 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
8886
MODIFIED_FILES="$(git --no-pager diff --name-only "$TRAVIS_COMMIT_RANGE" -- 2>/dev/null || :)"
8987

9088
if [ -n "$MODIFIED_FILES" ]; then
91-
AFFECTS_TRAVIS_CFG="$(echo "$MODIFIED_FILES" | grep -Fxq '.travis.yml' || echo 'no')"
92-
AFFECTS_PLAYBOOKS="$(echo "$MODIFIED_FILES" | grep -Eq '(vagrant|prod|deploy|bootstrap|/roles/.+)\.yml$' || echo 'no')"
93-
94-
if [ "$AFFECTS_TRAVIS_CFG" = 'no' ]; then
95-
if [ "$AFFECTS_PLAYBOOKS" = 'no' ]; then
96-
ANSIBLE_LINT_STATUS=skip
97-
fi
98-
fi
99-
10089
echo 'INFO: Some checks could be skipped'
10190
else
10291
echo "INFO: Couldn't determine list of modified files."
@@ -108,13 +97,6 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
10897
fi
10998

11099
echo
111-
112-
if [ "$ANSIBLE_LINT_STATUS" != 'skip' ]; then
113-
START_TIME=$SECONDS
114-
"$EXEC_CMD" ansible-lint >ansible_lint.log 2>&1 || ANSIBLE_LINT_STATUS=fail
115-
ANSIBLE_LINT_TIME=$((SECONDS - START_TIME))
116-
fi
117-
print_status "$ANSIBLE_LINT_STATUS" $ANSIBLE_LINT_TIME 'Run Ansible Lint'
118100
fi
119101

120102
START_TIME=$SECONDS
@@ -131,18 +113,14 @@ if [ "$DANGER_STATUS" != 'skip' ]; then
131113
fi
132114
print_status "$DANGER_STATUS" "$DANGER_TIME" 'Run danger'
133115

134-
if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
135-
[ "$ANSIBLE_LINT_STATUS" = 'skip' ] || print_log ansible_lint.log 'Run Ansible Lint'
136-
fi
137-
138116
print_log verify.log 'Run integration tests'
139117

140118
if [ "$DANGER_STATUS" != 'skip' ]; then
141119
print_log danger.log 'Run danger'
142120
fi
143121

144-
rm -f verify.log danger.log ansible_lint.log
122+
rm -f verify.log danger.log
145123

146-
if echo "$VERIFY_STATUS$DANGER_STATUS$ANSIBLE_LINT_STATUS" | grep -Fqs 'fail'; then
124+
if echo "$VERIFY_STATUS$DANGER_STATUS" | grep -Fqs 'fail'; then
147125
exit 1
148126
fi

0 commit comments

Comments
 (0)