diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 12d6f94d..39f15e5d 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -2,12 +2,15 @@ name: Docker build on: release: + types: [published] push: branches: - - "master" - pull_request: - branches: - - "master" + - master + paths: + - "src/datadoc/**" + - "poetry.lock" + - "Dockerfile" + - ".github/workflows/docker-build.yml" env: REGISTRY: europe-north1-docker.pkg.dev/artifact-registry-5n/dapla-metadata-docker/datadoc diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9d570f2a..73195f25 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,9 +3,16 @@ name: Tests on: push: branches: - - main - - master - pull_request: + - "**" + paths: + - "src/**" + - "tests/**" + - "docs/**" + - "pyproject.toml" + - "poetry.lock" + - ".pre-commit-config.yaml" + - "noxfile.py" + - ".github/workflows/tests.yml" jobs: tests: @@ -15,18 +22,14 @@ jobs: fail-fast: false matrix: include: - - { python: "3.11", os: "ubuntu-latest", session: "pre-commit" } + - { python: "3.12", os: "ubuntu-latest", session: "pre-commit" } - { python: "3.11", os: "ubuntu-latest", session: "mypy" } - - { python: "3.10", os: "ubuntu-latest", session: "mypy" } - { python: "3.12", os: "ubuntu-latest", session: "mypy" } - { python: "3.11", os: "ubuntu-latest", session: "tests" } - - { python: "3.10", os: "ubuntu-latest", session: "tests" } - { python: "3.12", os: "ubuntu-latest", session: "tests" } - - { python: "3.11", os: "windows-latest", session: "tests" } - - { python: "3.11", os: "macos-latest", session: "tests" } - - { python: "3.11", os: "ubuntu-latest", session: "typeguard" } - - { python: "3.11", os: "ubuntu-latest", session: "xdoctest" } - - { python: "3.11", os: "ubuntu-latest", session: "docs-build" } + - { python: "3.12", os: "ubuntu-latest", session: "typeguard" } + - { python: "3.12", os: "ubuntu-latest", session: "xdoctest" } + - { python: "3.12", os: "ubuntu-latest", session: "docs-build" } env: NOXSESSION: ${{ matrix.session }} @@ -41,8 +44,7 @@ jobs: uses: actions/setup-python@v5.0.0 with: python-version: ${{ matrix.python }} - cache: 'pip' # caching pip dependencies - + cache: "pip" # caching pip dependencies - name: Upgrade pip run: | @@ -124,8 +126,8 @@ jobs: - name: Set up Python uses: actions/setup-python@v5.0.0 with: - python-version: "3.11" - cache: 'pip' # caching pip dependencies + python-version: "3.12" + cache: "pip" # caching pip dependencies - name: Upgrade pip run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6e8b9afd..f817b5aa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ default_language_version: - python: python3.11 + python: python3.12 repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 @@ -16,7 +16,7 @@ repos: - id: check-ast - repo: https://github.com/ambv/black - rev: '23.12.1' + rev: "23.12.1" hooks: - id: black types: [python] diff --git a/Dockerfile b/Dockerfile index 1c6a19a9..3c6bb713 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ ARG PACKAGE_NAME=datadoc ARG APP_NAME=ssb_datadoc ARG APP_PATH=/opt/$PACKAGE_NAME -ARG PYTHON_VERSION=3.11 -ARG POETRY_VERSION=1.5.0 +ARG PYTHON_VERSION=3.12 +ARG POETRY_VERSION=1.8.2 # # Stage: build diff --git a/noxfile.py b/noxfile.py index bd949edd..a6800a41 100644 --- a/noxfile.py +++ b/noxfile.py @@ -118,7 +118,7 @@ def insert_header_in_hook(header: dict[str, str], lines: list[str]) -> str: return "\n".join(lines) -@session(name="pre-commit", python=python_versions[1]) +@session(name="pre-commit", python=python_versions[-1]) def precommit(session: Session) -> None: """Lint using pre-commit.""" args = session.posargs or [ @@ -138,7 +138,7 @@ def precommit(session: Session) -> None: activate_virtualenv_in_precommit_hooks(session) -@session(python=python_versions) +@session(python=python_versions[-2:]) def mypy(session: Session) -> None: """Type-check using mypy.""" args = session.posargs or ["src", "tests"] @@ -158,7 +158,7 @@ def mypy(session: Session) -> None: session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py") -@session(python=python_versions) +@session(python=python_versions[-2:]) def tests(session: Session) -> None: """Run the test suite.""" session.install(".") @@ -181,7 +181,7 @@ def tests(session: Session) -> None: session.notify("coverage", posargs=[]) -@session(python=python_versions[1]) +@session(python=python_versions[-1]) def coverage(session: Session) -> None: """Produce the coverage report.""" args = session.posargs or ["report", "--skip-empty"] @@ -194,7 +194,7 @@ def coverage(session: Session) -> None: session.run("coverage", *args) -@session(python=python_versions[1]) +@session(python=python_versions[-1]) def typeguard(session: Session) -> None: """Runtime type checking using Typeguard.""" session.install(".") @@ -204,7 +204,7 @@ def typeguard(session: Session) -> None: session.run("pytest", f"--typeguard-packages={package}", *session.posargs) -@session(python=python_versions) +@session(python=python_versions[-1]) def xdoctest(session: Session) -> None: """Run examples with xdoctest.""" if session.posargs: @@ -219,7 +219,7 @@ def xdoctest(session: Session) -> None: session.run("python", "-m", "xdoctest", *args) -@session(name="docs-build", python=python_versions[1]) +@session(name="docs-build", python=python_versions[-1]) def docs_build(session: Session) -> None: """Build the documentation.""" args = session.posargs or ["docs", "docs/_build"] @@ -238,7 +238,7 @@ def docs_build(session: Session) -> None: session.run("sphinx-build", *args) -@session(python=python_versions[1]) +@session(python=python_versions[-1]) def docs(session: Session) -> None: """Build and serve the documentation with live reloading on file changes.""" args = session.posargs or ["--open-browser", "docs", "docs/_build"]