From 2e93bffe7ca8355ced538804eab72faef8bfea7d Mon Sep 17 00:00:00 2001 From: Alex Lowe Date: Thu, 8 Aug 2024 19:59:03 -0400 Subject: [PATCH 1/3] ci: update renovate from starbase --- .github/renovate.json5 | 38 +++++++++++++++---------- .github/workflows/check-renovate.yaml | 40 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/check-renovate.yaml diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 1b1554b23..aadfcf211 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,6 +1,7 @@ { // Configuration file for RenovateBot: https://docs.renovatebot.com/configuration-options - extends: ["config:base"], + extends: ["config:recommended"], + baseBranches: ["$default", "/^hotfix\\/.*/"], ignoreDeps: [ // Each ignore is probably connected with an ignore in pyproject.toml. // Ensure you change this and those simultaneously. @@ -23,6 +24,7 @@ automerge: true, minimumReleaseAge: "0 seconds", schedule: ["at any time"], + matchBaseBranches: ["$default"], // Only do minor releases on main }, { // Same as above, but for hotfix branches, only for patch, and without auto-merging. @@ -47,8 +49,9 @@ // Update all internal packages in one higher-priority PR groupName: "internal packages", matchPackagePrefixes: ["craft-", "snap-"], - matchLanguages: ["python"], - prPriority: 2 + matchCategories: ["python"], + prPriority: 2, + matchBaseBranches: ["$default"], // Not for hotfix branches }, { // GitHub Actions are higher priority to update than most dependencies since they don't tend to break things. @@ -67,10 +70,10 @@ // Minor changes can be grouped and automerged for dev dependencies, but are also deprioritised. groupName: "development dependencies (non-major)", groupSlug: "dev-dependencies", - matchPackagePrefixes: [ - "dev", - "lint", - "types" + matchDepPatterns: [ + "dev/.*", + "lint/.*", + "types/.*" ], matchPackagePatterns: [ // Generated from the dependency dashboard, may not be complete. @@ -99,11 +102,13 @@ matchPackageNames: ["Sphinx", "furo"], matchPackagePatterns: ["[Ss]phinx.*$"], matchPackagePrefixes: ["docs"], + matchBaseBranches: ["$default"], // Not for hotfix branches }, { // Other major dependencies get deprioritised below minor dev dependencies. matchUpdateTypes: ["major"], - prPriority: -2 + prPriority: -2, + matchBaseBranches: ["$default"], // Not for hotfix branches }, { // Major dev dependencies are stone last, but grouped. @@ -127,19 +132,22 @@ "^(.*/)?ruff$", "^(.*/)?twine$", "^(.*/)?types-" - ] + ], + matchBaseBranches: ["$default"], // Not for hotfix branches }, { // Pyright makes regular breaking changes in patch releases, so we separate these // and do them independently. matchPackageNames: ["pyright"], - prPriority: -4 + prPriority: -4, + matchBaseBranches: ["$default"], // Not for hotfix branches } ], - regexManagers: [ + customManagers: [ { // tox.ini can get updates too if we specify for each package. fileMatch: ["tox.ini"], + customType: "regex", depTypeTemplate: "devDependencies", matchStrings: [ "# renovate: datasource=(?\\S+)\n\\s+(?.*?)(\\[[\\w]*\\])*[=><]=?(?.*?)\n" @@ -148,9 +156,11 @@ { // .pre-commit-config.yaml version updates fileMatch: [".pre-commit-config.yaml"], - depTypeTemplate: "devDependencies", + customType: "regex", + datasourceTemplate: "pypi", + depTypeTemplate: "lint", matchStrings: [ - "# renovate: datasource=(?\\S+);\\s*depName=(?.*?)\n\s+rev: \"v?(?.*?)\"" + "- repo: .*/<(?\\S+)\\s*\\n\\s*rev:\s+\"?v?(?\\S*)\"?", ] } ], @@ -161,7 +171,7 @@ prCreation: "not-pending", // Wait until status checks have completed before raising the PR prNotPendingHours: 4, // ...unless the status checks have been running for 4+ hours. prHourlyLimit: 1, // No more than 1 PR per hour. - stabilityDays: 2, // Wait 2 days from release before updating. + minimumReleaseAge: "2 days", automergeStrategy: "squash", // Squash & rebase when auto-merging. semanticCommitType: "build" // use `build` as commit header type (i.e. `build(deps): `) } diff --git a/.github/workflows/check-renovate.yaml b/.github/workflows/check-renovate.yaml new file mode 100644 index 000000000..7d13cfbf2 --- /dev/null +++ b/.github/workflows/check-renovate.yaml @@ -0,0 +1,40 @@ +name: Renovate check +on: + pull_request: + paths: + - ".github/workflows/check-renovate.yaml" + - ".github/renovate.json5" + + # Allows triggering the workflow manually from the Actions tab + workflow_dispatch: + inputs: + enable_ssh_access: + type: boolean + description: 'Enable ssh access' + required: false + default: false + +jobs: + renovate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install node + uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Install renovate + run: npm install --global renovate + - name: Enable ssh access + uses: mxschmitt/action-tmate@v3 + if: ${{ inputs.enable_ssh_access }} + with: + limit-access-to-actor: true + - name: Check renovate config + run: renovate-config-validator .github/renovate.json5 + - name: Renovate dry-run + run: renovate --dry-run --autodiscover + env: + RENOVATE_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RENOVATE_USE_BASE_BRANCH_CONFIG: ${{ github.ref }} From 87a67d310dadeefdc8aa393e46d49addcf9f7c6f Mon Sep 17 00:00:00 2001 From: Alex Lowe Date: Thu, 8 Aug 2024 20:22:13 -0400 Subject: [PATCH 2/3] chore: more --- .github/renovate.json5 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index aadfcf211..4353d53a0 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -76,12 +76,17 @@ "types/.*" ], matchPackagePatterns: [ - // Generated from the dependency dashboard, may not be complete. + // Brought from charmcraft. May not be complete. + // This helps group dependencies in requirements-dev.txt files. "^(.*/)?autoflake$", "^(.*/)?black$", + "^(.*/)?codespell$", + "^(.*/)?coverage$", "^(.*/)?flake8$", "^(.*/)?hypothesis$", + "^(.*/)?mypy$", "^(.*/)?pycodestyle$", + "^(.*/)?docstyle$", "^(.*/)?pyfakefs$", "^(.*/)?pyflakes$", "^(.*/)?pylint$", @@ -89,7 +94,8 @@ "^(.*/)?responses$", "^(.*/)?ruff$", "^(.*/)?twine$", - "^(.*/)?types-" + "^(.*/)?tox$", + "^(.*/)?types-", ], matchUpdateTypes: ["minor", "patch", "pin", "digest"], prPriority: -1, From c75077306d5ef3771855513f2f0e40c136052017 Mon Sep 17 00:00:00 2001 From: Alex Lowe Date: Wed, 14 Aug 2024 08:57:58 -0400 Subject: [PATCH 3/3] chore: upstream fixes --- .github/renovate.json5 | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 4353d53a0..b1019279d 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,23 +1,21 @@ { // Configuration file for RenovateBot: https://docs.renovatebot.com/configuration-options - extends: ["config:recommended"], - baseBranches: ["$default", "/^hotfix\\/.*/"], + extends: ["config:recommended", ":semanticCommitTypeAll(build)"], ignoreDeps: [ // Each ignore is probably connected with an ignore in pyproject.toml. // Ensure you change this and those simultaneously. - "pydantic", // Needs to wait for libraries. - "pydantic-yaml", // Needs to wait for pydantic "urllib3", "windows", // We'll update Windows versions manually. ], labels: ["dependencies"], // For convenient searching in GitHub + baseBranches: ["$default", "/^hotfix\\/.*/"], pip_requirements: { fileMatch: ["^tox.ini$", "(^|/)requirements([\\w-]*)\\.txt$", "^.pre-commit-config.yaml$"] }, packageRules: [ { // Internal package minor patch updates get top priority, with auto-merging - groupName: "internal package patch releases", + groupName: "internal package minor releases", matchPackagePatterns: ["^craft-.*"], matchUpdateTypes: ["minor", "patch", "pin", "digest"], prPriority: 10, @@ -34,13 +32,13 @@ 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. // Also groups these changes together. groupName: "bugfixes", - excludePackagePrefixes: ["lint", "types"], + excludeDepPatterns: ["lint/.*", "types/.*"], matchUpdateTypes: ["patch", "pin", "digest"], prPriority: 3, // Patches should go first! automerge: true @@ -48,7 +46,7 @@ { // Update all internal packages in one higher-priority PR groupName: "internal packages", - matchPackagePrefixes: ["craft-", "snap-"], + matchDepPatterns: ["craft-.*", "snap-.*"], matchCategories: ["python"], prPriority: 2, matchBaseBranches: ["$default"], // Not for hotfix branches @@ -107,11 +105,11 @@ groupSlug: "doc-dependencies", matchPackageNames: ["Sphinx", "furo"], matchPackagePatterns: ["[Ss]phinx.*$"], - matchPackagePrefixes: ["docs"], + matchDepPatterns: ["docs/.*"], matchBaseBranches: ["$default"], // Not for hotfix branches }, { - // Other major dependencies get deprioritised below minor dev dependencies. + // Other major dependencies get deprioritised below minor dev dependencies. matchUpdateTypes: ["major"], prPriority: -2, matchBaseBranches: ["$default"], // Not for hotfix branches @@ -123,6 +121,7 @@ matchDepTypes: ["devDependencies"], matchUpdateTypes: ["major"], prPriority: -3, + matchBaseBranches: ["$default"], // Not for hotfix branches matchPackagePatterns: [ // Generated from the dependency dashboard, may not be complete. "^(.*/)?autoflake$", @@ -139,12 +138,11 @@ "^(.*/)?twine$", "^(.*/)?types-" ], - matchBaseBranches: ["$default"], // Not for hotfix branches }, { // Pyright makes regular breaking changes in patch releases, so we separate these // and do them independently. - matchPackageNames: ["pyright"], + matchPackageNames: ["pyright", "types/pyright"], prPriority: -4, matchBaseBranches: ["$default"], // Not for hotfix branches }