Skip to content

Commit 4e94814

Browse files
committed
build: update project setup
- Use uv as the project management tool. - Add scriv to manage the changelog. - Add ty and ruff for static checks. - Properly bump to 19.0.1. - Update the workflow files. - Add commitlint checks and configuration.
1 parent 9f5b12e commit 4e94814

16 files changed

Lines changed: 1263 additions & 179 deletions

File tree

.github/workflows/ci.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
env:
11+
UV_VERSION: 0.10.2
12+
13+
jobs:
14+
commitlint:
15+
name: Commit Linter
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v6
19+
with:
20+
fetch-depth: 0
21+
- uses: wagoid/commitlint-github-action@v6
22+
23+
tests:
24+
name: Run Tests
25+
runs-on: ubuntu-latest
26+
strategy:
27+
matrix:
28+
python-version: ["3.9", "3.10", "3.11", "3.12"]
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v6
32+
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@v7
35+
with:
36+
enable-cache: true
37+
version: ${{ env.UV_VERSION }}
38+
python-version: ${{ matrix.python-version }}
39+
40+
- name: Run quality checks
41+
run: make quality
42+
43+
- name: Validate package build
44+
run: uv build
45+
46+
release:
47+
name: Build and publish package
48+
needs: tests
49+
runs-on: ubuntu-latest
50+
if: github.event_name == 'workflow_dispatch'
51+
# TODO: un-comment if we add this package to PyPI
52+
# permissions:
53+
# # IMPORTANT: this permission is mandatory for Trusted Publishing
54+
# id-token: write
55+
# contents: write
56+
steps:
57+
- name: Checkout repository
58+
uses: actions/checkout@v6
59+
60+
- name: Install uv
61+
uses: astral-sh/setup-uv@v7
62+
with:
63+
enable-cache: true
64+
version: ${{ env.UV_VERSION }}
65+
66+
- name: Build packages
67+
run: uv build
68+
69+
- name: Create Release
70+
env:
71+
GH_TOKEN: ${{ github.token }}
72+
run: |
73+
VERSION=$(uv version --short)
74+
uv run scriv print --version $VERSION --output release-body
75+
76+
gh release create "v${VERSION}" \
77+
--title ${VERSION} \
78+
--target "${{ github.sha }}" \
79+
--notes-file release-body \
80+
dist/*
81+
82+
# TODO: un-comment if we add this package to PyPI
83+
# - name: Publish to PyPI
84+
# run: |
85+
# uv publish \
86+
# --trusted-publishing always \
87+
# dist/*

.github/workflows/docker.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,25 @@ on:
99
env:
1010
REGISTRY: docker.io
1111
IMAGE_NAME: docker.io/ednxops/drydock-backups
12+
UV_VERSION: 0.10.2
1213

1314
jobs:
1415
build:
1516
runs-on: ubuntu-latest
1617
steps:
1718

1819
- name: Checkout repository
19-
uses: actions/checkout@v4
20+
uses: actions/checkout@v6
2021

21-
- name: Python Semantic Release
22-
uses: actions/setup-python@v5
22+
- name: setup uv
23+
uses: astral-sh/setup-uv@v7
2324
with:
24-
python-version: 3.11
25+
python-version: "3.12"
26+
enable-cache: true
27+
version: ${{ env.UV_VERSION }}
2528

26-
- name: Install dependencies
27-
run: |
28-
pip install -e .
29+
- name: Install the project
30+
run: uv sync --locked --all-extras --dev
2931

3032
- name: Set up Docker Buildx
3133
uses: docker/setup-buildx-action@v3
@@ -39,14 +41,14 @@ jobs:
3941

4042
- name: Setup Tutor
4143
run: |
42-
tutor plugins disable indigo mfe
43-
tutor plugins enable drydock-backups
44+
uv run tutor plugins disable indigo mfe
45+
uv run tutor plugins enable drydock-backups
4446
4547
- name: Build Docker image
4648
run: |
47-
tutor images build backups
49+
uv run tutor images build backups
4850
4951
- name: Push Docker image
5052
if: github.event_name == 'workflow_dispatch'
5153
run: |
52-
tutor images push backups
54+
uv run tutor images push backups

.github/workflows/release.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
# CHANGELOG
22

3+
<!--
4+
All enhancements and changes will be documented in this file. It adheres to
5+
the structure of http://keepachangelog.com/ ,
36
7+
This project adheres to Semantic Versioning (http://semver.org/).
8+
-->
9+
10+
## Unreleased
11+
12+
See the fragment files in the [changelog.d/ directory](./changelog.d).
13+
14+
<!-- scriv-insert-here -->
15+
16+
<a id='changelog-19.0.1'></a>
17+
## 19.0.1 — 2026-02-13
18+
19+
### Fixed
20+
21+
- Properly check if the MinIO plugin is enabled before adding the initialization
22+
jobs.
23+
- Don't override the MongoDB user role in case `BACKUP_MONGO_USERNAME` is an
24+
existing user.
25+
- Reduce the job history limit to 0 to avoid dangling Pods and PVCs.
26+
27+
<a id='changelog-19.0.0'></a>
428
## v19.0.0 (2025-02-03)
529

630
### Continuous Integration

MANIFEST.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

Makefile

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
.DEFAULT_GOAL := help
2+
.PHONY: help
23

3-
release: ## release a new version
4-
@echo "Releasing a new version."
5-
@echo "This is a remote release, it will push to the remote repository."
6-
semantic-release -vv version --changelog --push --tag --commit
4+
quality: ## Run linters
5+
uv run ruff check
6+
uv run ruff format --diff
7+
uv run ty check
78

8-
local-release:
9-
@echo "Releasing a new version."
10-
@echo "This is a local release, it will not push to the remote repository."
11-
@echo "You can push the changes and release manually."
12-
semantic-release -vv version --changelog --commit --no-push
9+
quality-fix: ## Run automatic linter fixes
10+
uv run ruff format
11+
uv run ruff check --fix
1312

14-
selfcheck: ## check that the Makefile is well-formed
15-
@echo "The Makefile is well-formed."
13+
changelog-entry: ## Run scriv to create a changelog entry
14+
uv run scriv create
1615

17-
ESCAPE = \033
16+
changelog-collect: ## Collect all the changelog entries and rebuild CHANGELOG.md
17+
uv run scriv collect
18+
19+
ESCAPE = 
1820
help: ## Print this help
19-
@grep -E '^([.a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \
21+
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \
2022
| sed 's/######* \(.*\)/@ $(ESCAPE)[1;31m\1$(ESCAPE)[0m/g' | tr '@' '\n' \
2123
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{% if version %}{{ version }} — {% endif %}{{ date.strftime('%Y-%m-%d') }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
For top level release notes, leave all the headers commented out.
6+
-->
7+
8+
{% for cat in config.categories -%}
9+
<!--
10+
### {{ cat }}
11+
12+
- A bullet item for the {{ cat }} category.
13+
14+
-->
15+
{% endfor -%}

commitlint.config.mjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// See: https://commitlint.js.org/#/reference-configuration for details
2+
// on the configuration file
3+
export default {
4+
extends: ['@commitlint/config-conventional'],
5+
6+
rules: {
7+
'type-enum':
8+
[2, 'always', [
9+
'revert', 'feat', 'fix', 'perf', 'docs', 'test', 'build', 'refactor', 'style', 'chore', 'temp', 'ci',
10+
]],
11+
12+
// Default rules we want to suppress. The available list of rules can be
13+
// found in https://commitlint.js.org/#/reference-rules
14+
'body-leading-blank': [0, "always"],
15+
'body-max-line-length': [0, "always"],
16+
'footer-max-line-length': [0, "always"],
17+
'footer-leading-blank': [0, "always"],
18+
'subject-case': [0, "always", []],
19+
'subject-full-stop': [0, "never", '.'],
20+
},
21+
22+
ignores: [
23+
// Allow GitHub revert messages, like:
24+
// Revert "introduce a bug"
25+
// Revert "introduce a bug" (#1234)
26+
message => /^Revert ".*"( \(#\d+\))?/.test(message),
27+
28+
// BTW: commitlint has a built-in list of ignores which are also applied.
29+
// Those include the typical "Merged" messages, so those are implicitly ignored:
30+
// https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/is-ignored/src/defaults.ts
31+
],
32+
};

drydock_backups/__about__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
__version__ = "19.0.0"
1+
from importlib import metadata
2+
3+
__version__ = metadata.version("drydock-backups")

0 commit comments

Comments
 (0)