Skip to content
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,25 @@ jobs:
run: |
poetry run python -m nox -s docs:build

Changelog:
name: Changelog Update Check
runs-on: ubuntu-latest

steps:
- name: SCM Checkout
uses: actions/checkout@v4

- name: Fetch the main branch
run: git fetch origin main

- name: Setup Python & Poetry Environment
uses: ./.github/actions/python-environment
with:
python-version: "3.9"

- name: Run changelog update check
run: poetry run nox -s changelog:updated

build-matrix:
name: Generate Build Matrix
uses: ./.github/workflows/matrix-python.yml
Expand Down
4 changes: 4 additions & 0 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# Unreleased

## ✨ Added

* [#65](https://github.com/exasol/python-toolbox/issues/65): Added a Nox task for checking if the changelog got updated.
33 changes: 33 additions & 0 deletions exasol/toolbox/nox/_documentation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from __future__ import annotations

import shutil
import subprocess
import sys
import webbrowser
from pathlib import Path

import nox
from nox import Session
Expand Down Expand Up @@ -36,6 +39,25 @@ def _build_multiversion_docs(session: nox.Session, config: Config) -> None:
)


def _git_diff_changes_main() -> int:
"""
Check if doc/changes is changed and return the exit code of command git diff.
The exit code is 0 if there are no changes.
"""
p = subprocess.run(
[
"git",
"diff",
"--quiet",
"origin/main",
"--",
PROJECT_CONFIG.root / "doc/changes",
],
capture_output=True,
)
return p.returncode


@nox.session(name="docs:multiversion", python=False)
def build_multiversion(session: Session) -> None:
"""Builds the multiversion project documentation"""
Expand Down Expand Up @@ -64,3 +86,14 @@ def clean_docs(_session: Session) -> None:
docs_folder = PROJECT_CONFIG.root / DOCS_OUTPUT_DIR
if docs_folder.exists():
shutil.rmtree(docs_folder)


@nox.session(name="changelog:updated", python=False)
def updated(_session: Session) -> None:
"""Checks if the change log has been updated"""
if _git_diff_changes_main() == 0:
print(
"Changelog is not updated.\n"
"Please describe your changes in the changelog!"
)
sys.exit(1)
1 change: 1 addition & 0 deletions exasol/toolbox/nox/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def check(session: Session) -> None:
build_docs,
clean_docs,
open_docs,
updated,
)
from exasol.toolbox.nox._release import prepare_release
from exasol.toolbox.nox._shared import (
Expand Down
16 changes: 16 additions & 0 deletions exasol/toolbox/templates/github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ jobs:
name: Generate Build Matrix
uses: ./.github/workflows/matrix-python.yml

Changelog:
name: Changelog Update Check
runs-on: ubuntu-latest

steps:
- name: SCM Checkout
uses: actions/checkout@v4

- name: Setup Python & Poetry Environment
uses: ./.github/actions/python-environment
with:
python-version: "3.9"

- name: Run changelog update check
run: poetry run nox -s changelog:updated

Lint:
name: Linting (Python-${{ matrix.python-version }})
needs: [ Version-Check, build-matrix ]
Expand Down