Skip to content

Commit

Permalink
Add CI job for changed changelog
Browse files Browse the repository at this point in the history
Job checks if the CHANGELOG.md was modified in current branch (compared
to origin/main)

Internal-tag: [#65786]
Signed-off-by: bbrzyski <[email protected]>
  • Loading branch information
bbrzyski authored and rw1nkler committed Oct 14, 2024
1 parent 9f5427f commit 530b975
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ pyright_check:
- ./.github/scripts/ci.sh pyright_check
allow_failure: true

changelog_check:
image: debian:bookworm
variables:
SCALENODE_RAM: 3072
SCALENODE_CPU: 3
stage: test
script:
- ./.github/scripts/ci.sh changelog_check
allow_failure: true

build_docs:
variables:
SCALENODE_RAM: 18432
Expand Down
16 changes: 14 additions & 2 deletions .github/scripts/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,20 @@ pyright_check(){
install_topwrap_system_deps
install_nox

begin_command_group "checking types"
begin_command_group "Checking types"
log_cmd nox -s pyright_check -- compare
end_command_group
}

changelog_check(){
install_common_system_packages
install_nox

begin_command_group "Checking if changelog was changed"
log_cmd nox -s changed_changelog
end_command_group
}

case "$1" in
lint)
run_lint
Expand All @@ -204,10 +213,13 @@ package_dist)
pyright_check)
pyright_check
;;
changelog_check)
changelog_check
;;
docs)
generate_docs
;;
*)
echo "Usage: $0 {lint|test_python|examples|package_cores|package_dist|docs|pyright_check}"
echo "Usage: $0 {lint|test_python|examples|package_cores|package_dist|docs|pyright_check|changelog_check}"
;;
esac
22 changes: 22 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ jobs:
run: |
./.github/scripts/ci.sh pyright_check
changelog_changed:
runs-on: ubuntu-latest
container:
image: debian:bookworm
name: "Check if changelog was changed"

steps:
- name: Install git package
run: |
apt-get update -qq
apt-get install -y git
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run changelog check
continue-on-error: true
run: |
git config --add safe.directory "$(pwd)"
./.github/scripts/ci.sh changelog_check
test_python_3_8:
runs-on: ubuntu-latest
container:
Expand Down
17 changes: 17 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,20 @@ def package_cores(session: nox.Session) -> None:
session.run("python", ".github/scripts/package_cores.py", "--log-level", session.posargs[0])
else:
session.run("python", ".github/scripts/package_cores.py")


@nox.session
def changed_changelog(session: nox.Session) -> None:
changelog_file_name = "CHANGELOG.md"
changelog_changed = session.run(
"git",
"diff",
"--name-only",
"origin/main",
"--",
changelog_file_name,
external=True,
silent=True,
)
if not changelog_changed:
raise CommandFailed()

0 comments on commit 530b975

Please sign in to comment.