diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bbfa389b..79b09290 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -68,6 +68,38 @@ rustfmt: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_REF_NAME == 'main' +changelog-update: + stage: lint + extends: + - .stable + # Check in the commit message for "skip.?changelog", if not present + # then check for changes in changelogs. + # XXX: It looks like $CI_COMMIT_MESSAGE mangles newlines so it's not + # possible to require the "skip.?changelog" string to be on its own line, + # that means it would also trigger within a wall of text. Not so obvious. + # TODO: Check the whole MR for updates in changelogs, not just the last + # commit. + script: + - apt update; apt install -y --no-install-recommends git python3 + - echo $CI_COMMIT_MESSAGE + - | + /usr/bin/env python3 -c " + import os, re, subprocess, sys + if re.search(r'skip changelog', os.environ['CI_COMMIT_MESSAGE'], flags=re.I) is not None: + print('Changelog skipped.') + sys.exit(0) + foo=subprocess.run(['git', 'log', '-1', '--oneline'], capture_output=True).stdout + print(f'FOO1:\n {foo}') + diff=subprocess.run(['git', 'diff-tree', '--no-commit-id', '-r', 'HEAD'], capture_output=True).stdout + print(f'FOO2:\n {diff}') + if re.search(b'[AM]\\s+\\S*changelog', diff, flags=re.I) is None: + print('Please update the Changelog. Use \"skip-changelog\" in the commit message to skip this check.') + sys.exit(1) + print('Changelog has been updated as expected.')" + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_REF_NAME == 'main' + stable-test: extends: - .test diff --git a/xmpp/ChangeLog b/xmpp/ChangeLog index 69b4a07d..cb6eed65 100644 --- a/xmpp/ChangeLog +++ b/xmpp/ChangeLog @@ -5,6 +5,8 @@ XXXX-YY-ZZ [ RELEASER ] - Agent::wait_for_events now return Vec and sets inner tokio_xmpp Client auto-reconnect to true... It is still aware of Event::Disconnected but should no longer have weird hanging state or panic (!436) + * CI: + - Enforce changelog updates in Gitlab CI. Version 0.6.0: 2024-07-27 [ Maxime “pep” Buquet ]