Skip to content

Commit

Permalink
Merge branch 'main' into work/bash-completion/CRAFT-3875
Browse files Browse the repository at this point in the history
  • Loading branch information
tigarmo authored Jan 27, 2025
2 parents d1c79a3 + c8c5883 commit e8055de
Show file tree
Hide file tree
Showing 94 changed files with 387 additions and 411 deletions.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ body:
render: shell
validations:
required: true

2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?

-----
---
4 changes: 2 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Add 'documentation' label to any changes within 'docs' folder or any subfolders
documentation:
- changed-files:
- any-glob-to-any-file: docs/**
- changed-files:
- any-glob-to-any-file: docs/**
2 changes: 1 addition & 1 deletion .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ categories:
label:
- "tooling"

change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"

template: |
Special thanks to the contributors that made this release happen: $CONTRIBUTORS
Expand Down
50 changes: 25 additions & 25 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
"pydantic-yaml", // Updates with pydantic
"mcr.microsoft.com/dotnet/runtime-deps", // This is intentionally dotnet 6
],
labels: ["dependencies"], // For convenient searching in GitHub
labels: ["dependencies"], // For convenient searching in GitHub
baseBranches: ["$default", "/^hotfix\\/.*/"],
pip_requirements: {
fileMatch: ["^tox.ini$", "(^|/)requirements([\\w-]*)\\.txt$", "^.pre-commit-config.yaml$"]
fileMatch: [
"^tox.ini$",
"(^|/)requirements([\\w-]*)\\.txt$",
"^.pre-commit-config.yaml$",
],
},
packageRules: [
packageRules: [
{
// Internal package minor patch updates get top priority, with auto-merging
groupName: "internal package minor releases",
Expand All @@ -21,7 +25,7 @@
automerge: true,
minimumReleaseAge: "0 seconds",
schedule: ["at any time"],
matchBaseBranches: ["$default"], // Only do minor releases on main
matchBaseBranches: ["$default"], // Only do minor releases on main
},
{
// Same as above, but for hotfix branches, only for patch, and without auto-merging.
Expand All @@ -31,7 +35,7 @@
prPriority: 10,
minimumReleaseAge: "0 seconds",
schedule: ["at any time"],
matchBaseBranches: ["/^hotfix\\/.*/"], // All hotfix branches
matchBaseBranches: ["/^hotfix\\/.*/"], // All hotfix branches
},
{
// Automerge patches, pin changes and digest changes.
Expand All @@ -40,15 +44,15 @@
excludeDepPatterns: ["lint/.*", "types/.*"],
matchUpdateTypes: ["patch", "pin", "digest"],
prPriority: 3, // Patches should go first!
automerge: true
automerge: true,
},
{
// Update all internal packages in one higher-priority PR
groupName: "internal packages",
matchDepPatterns: ["craft-.*", "snap-.*"],
matchCategories: ["python"],
prPriority: 2,
matchBaseBranches: ["$default"], // Not for hotfix branches
matchBaseBranches: ["$default"], // Not for hotfix branches
},
{
// GitHub Actions are higher priority to update than most dependencies since they don't tend to break things.
Expand All @@ -67,11 +71,7 @@
// Minor changes can be grouped and automerged for dev dependencies, but are also deprioritised.
groupName: "development dependencies (non-major)",
groupSlug: "dev-dependencies",
matchDepPatterns: [
"dev/.*",
"lint/.*",
"types/.*"
],
matchDepPatterns: ["dev/.*", "lint/.*", "types/.*"],
matchPackagePatterns: [
// Brought from charmcraft. May not be complete.
// This helps group dependencies in requirements-dev.txt files.
Expand All @@ -96,7 +96,7 @@
],
matchUpdateTypes: ["minor", "patch", "pin", "digest"],
prPriority: -1,
automerge: true
automerge: true,
},
{
// Documentation related updates
Expand All @@ -105,13 +105,13 @@
matchPackageNames: ["Sphinx", "furo"],
matchPackagePatterns: ["[Ss]phinx.*$"],
matchDepPatterns: ["docs/.*"],
matchBaseBranches: ["$default"], // Not for hotfix branches
matchBaseBranches: ["$default"], // Not for hotfix branches
},
{
// Other major dependencies get deprioritised below minor dev dependencies.
matchUpdateTypes: ["major"],
prPriority: -2,
matchBaseBranches: ["$default"], // Not for hotfix branches
matchBaseBranches: ["$default"], // Not for hotfix branches
},
{
// Major dev dependencies are stone last, but grouped.
Expand All @@ -120,7 +120,7 @@
matchDepTypes: ["devDependencies"],
matchUpdateTypes: ["major"],
prPriority: -3,
matchBaseBranches: ["$default"], // Not for hotfix branches
matchBaseBranches: ["$default"], // Not for hotfix branches
matchPackagePatterns: [
// Generated from the dependency dashboard, may not be complete.
"^(.*/)?autoflake$",
Expand All @@ -135,16 +135,16 @@
"^(.*/)?responses$",
"^(.*/)?ruff$",
"^(.*/)?twine$",
"^(.*/)?types-"
"^(.*/)?types-",
],
},
{
// Pyright makes regular breaking changes in patch releases, so we separate these
// and do them independently.
matchPackageNames: ["pyright", "types/pyright"],
prPriority: -4,
matchBaseBranches: ["$default"], // Not for hotfix branches
}
matchBaseBranches: ["$default"], // Not for hotfix branches
},
],
customManagers: [
{
Expand All @@ -153,8 +153,8 @@
customType: "regex",
depTypeTemplate: "devDependencies",
matchStrings: [
"# renovate: datasource=(?<datasource>\\S+)\n\\s+(?<depName>.*?)(\\[[\\w]*\\])*[=><]=?(?<currentValue>.*?)\n"
]
"# renovate: datasource=(?<datasource>\\S+)\n\\s+(?<depName>.*?)(\\[[\\w]*\\])*[=><]=?(?<currentValue>.*?)\n",
],
},
{
// .pre-commit-config.yaml version updates
Expand All @@ -163,9 +163,9 @@
datasourceTemplate: "pypi",
depTypeTemplate: "lint",
matchStrings: [
"- repo: .*/<(?<depName>\\S+)\\s*\\n\\s*rev:\s+\"?v?(?<currentValue>\\S*)\"?",
]
}
'- repo: .*/<(?<depName>\\S+)\\s*\\n\\s*rev:\s+"?v?(?<currentValue>\\S*)"?',
],
},
],
timezone: "Etc/UTC",
schedule: ["every weekend"],
Expand All @@ -176,5 +176,5 @@
prHourlyLimit: 1, // No more than 1 PR per hour.
minimumReleaseAge: "2 days",
automergeStrategy: "squash", // Squash & rebase when auto-merging.
semanticCommitType: "build" // use `build` as commit header type (i.e. `build(deps): <description>`)
semanticCommitType: "build", // use `build` as commit header type (i.e. `build(deps): <description>`)
}
6 changes: 3 additions & 3 deletions .github/workflows/policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
- hotfix/*
- work/check-policy # For development
- work/check-policy # For development

jobs:
policy:
Expand All @@ -16,6 +16,6 @@ jobs:
with:
packages: python-apt-dev
# requirements-noble.txt can't build on jammy
requirements-find-args: '! -name requirements-noble.txt'
osv-extra-args: '--config=source/osv-scanner.toml'
requirements-find-args: "! -name requirements-noble.txt"
osv-extra-args: "--config=source/osv-scanner.toml"
uv-export: false
3 changes: 1 addition & 2 deletions .github/workflows/snap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
branches:
- "feature/**"


jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -32,7 +31,7 @@ jobs:
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]
then
echo "branch=pr-${{ github.event.number }}" >> "$GITHUB_OUTPUT"
echo "branch=pr-${{ github.event.number }}" >> "$GITHUB_OUTPUT"
else
branch=$(echo ${GITHUB_REF#refs/*/} | sed -e 's|feature/\(.*\)|\1|')
echo "branch=$branch" >> "$GITHUB_OUTPUT"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spread-manual.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Spread (manual - large/flaky)
on:
pull_request:
types: [ labeled ]
types: [labeled]
schedule:
- cron: "0 2 * * 0,3" # run at 2 AM on Sundays and Wednesdays

Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Run large/flaky tests
id: flaky
run: spread tests/spread/manual/

- name: Discard spread workers
if: always()
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ jobs:
shopt -s nullglob
for r in .spread-reuse.*.yaml; do
spread -discard -reuse-pid="$(echo "$r" | grep -o -E '[0-9]+')"
done
done
7 changes: 3 additions & 4 deletions .github/workflows/tics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: TICS
on:
push:
branches:
- main
# to easy test changes to the workflow
- tiobe
- main
# to easy test changes to the workflow
- tiobe

jobs:
CI:
Expand Down Expand Up @@ -33,7 +33,6 @@ jobs:
run: |
python -m pip install -e .
- name: Run coverage
run: |
make coverage
Expand Down
8 changes: 5 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ repos:
args: [--fix, --exit-non-zero-on-fix]
# Run the formatter
- id: ruff-format
- repo: https://github.com/adrienverge/yamllint.git
rev: "v1.35.1"
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "" # Intentionally blank, despite the warning.
hooks:
- id: yamllint
- id: prettier
additional_dependencies:
- [email protected]
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Tool-generated
schema/rockcraft.json

# External code
tools/external
docs/sphinx-starter-pack
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ build:
python: "3.10"
jobs:
post_checkout:
- git fetch --tags --unshallow # Also fetch tags
- git describe # Make sure we get a proper version
- git fetch --tags --unshallow # Also fetch tags
- git describe # Make sure we get a proper version

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ UV_FROZEN=true
include common.mk

.PHONY: format
format: format-ruff format-codespell ## Run all automatic formatters
format: format-ruff format-codespell format-prettier ## Run all automatic formatters

.PHONY: lint
lint: lint-ruff lint-codespell lint-mypy lint-pyright lint-shellcheck lint-docs lint-twine ## Run all linters
lint: lint-ruff lint-codespell lint-mypy lint-prettier lint-pyright lint-shellcheck lint-docs lint-twine ## Run all linters

.PHONY: pack
pack: pack-pip pack-snap ## Build all packages
Expand Down
24 changes: 21 additions & 3 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ else
APT := apt-get
endif

PRETTIER=npm exec --package=prettier -- prettier
PRETTIER_FILES="**/*.{yaml,yml,json,json5,css,md}"

.DEFAULT_GOAL := help

.ONESHELL:
Expand Down Expand Up @@ -82,6 +85,10 @@ format-ruff: install-ruff ##- Automatically format with ruff
format-codespell: ##- Fix spelling issues with codespell
uv run codespell --toml pyproject.toml --write-changes $(SOURCES)

.PHONY: format-prettier
format-prettier: install-npm ##- Format files with prettier
$(PRETTIER) --write $(PRETTIER_FILES)

.PHONY: lint-ruff
lint-ruff: install-ruff ##- Lint with ruff
ifneq ($(CI),)
Expand Down Expand Up @@ -137,12 +144,12 @@ ifneq ($(CI),)
@echo ::endgroup::
endif

.PHONY: lint-yaml
lint-yaml: ##- Lint YAML files with yamllint
.PHONY: lint-prettier
lint-prettier: install-npm ##- Lint files with prettier
ifneq ($(CI),)
@echo ::group::$@
endif
uv run --extra lint yamllint .
$(PRETTIER) --check $(PRETTIER_FILES)
ifneq ($(CI),)
@echo ::endgroup::
endif
Expand Down Expand Up @@ -266,3 +273,14 @@ else ifneq ($(shell which brew),)
else
$(warning Shellcheck not installed. Please install it yourself.)
endif

.PHONY: install-npm
install-npm:
ifneq ($(shell which npm),)
else ifneq ($(shell which snap),)
sudo snap install --classic node
else ifneq ($(shell which brew),)
brew install node
else
$(error npm not installed. Please install it yourself.)
endif
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: bare-python
base: bare # using a bare base
build-base: [email protected] # using Ubuntu Jammy only for the build environment
base: bare # using a bare base
build-base: [email protected] # using Ubuntu Jammy only for the build environment
version: "3.11"
summary: Python3.11 rock with a bare base
description: Example of a distroless-like Python rock
platforms:
amd64:
run-user: _daemon_ # setting a non-root user for the rock
run-user: _daemon_ # setting a non-root user for the rock
parts:
install-python:
plugin: nil
# install Python3.11
stage-packages:
- base-files # also install base-files to ensure a basic filesystem structure
- base-files # also install base-files to ensure a basic filesystem structure
- python3.11
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: chiselled-python
base: bare # using a bare base
build-base: [email protected] # using Ubuntu Jammy only for the build environment
base: bare # using a bare base
build-base: [email protected] # using Ubuntu Jammy only for the build environment
version: "3.11"
summary: Chiselled Python3.11 rock
description: Example of a chiselled Python rock
platforms:
amd64:
run-user: _daemon_ # setting a non-root user for the rock
run-user: _daemon_ # setting a non-root user for the rock
parts:
install-python-slices:
plugin: nil
Expand Down
Loading

0 comments on commit e8055de

Please sign in to comment.