Skip to content

Commit

Permalink
chore: use slim renovate with constraints (#579)
Browse files Browse the repository at this point in the history
Co-authored-by: huxuan-assistant[bot] <163485190+huxuan-assistant[bot]@users.noreply.github.com>
  • Loading branch information
huxuan and huxuan-assistant[bot] authored May 23, 2024
1 parent 2bcf9ce commit 6535f7d
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 22 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
RENOVATE_BRANCH_PREFIX: renovate-github/
RENOVATE_ENABLED: ${{ vars.RENOVATE_ENABLED || true }}
RENOVATE_ENABLED_MANAGERS: '["pep621", "github-actions", "gitlabci", "regex", "pre-commit"]'
RENOVATE_OPTIMIZE_FOR_DISABLED: "true"
RENOVATE_OPTIMIZE_FOR_DISABLED: 'true'
RENOVATE_PLATFORM: github
RENOVATE_REPOSITORIES: '["${{ github.repository }}"]'
RENOVATE_REPOSITORY_CACHE: enabled
image: ghcr.io/renovatebot/renovate:37.368.8-full@sha256:ec42750b18504058611851753fb5822522c1999a39476eefc083be70f179a74e
options: "--user root"
image: ghcr.io/renovatebot/renovate:37.374.3@sha256:a12297dde4fad3d54111c3e4471aae726e7bc99bd407b74886394c41bc227250
options: '--user root'
runs-on: ubuntu-22.04
steps:
- run: env | sort
Expand Down Expand Up @@ -48,5 +48,5 @@ jobs:
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "*/15 0-3 * * 1"
- cron: '*/15 0-3 * * 1'
workflow_dispatch: null
2 changes: 1 addition & 1 deletion .gitlab/workflows/renovate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ renovate:
key: ${CI_COMMIT_REF_SLUG}-renovate
paths:
- renovate/cache/renovate/repository/
image: renovate/renovate:37.368.8-full@sha256:ec42750b18504058611851753fb5822522c1999a39476eefc083be70f179a74e
image: renovate/renovate:37.374.3@sha256:a12297dde4fad3d54111c3e4471aae726e7bc99bd407b74886394c41bc227250
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" && $PAT != null
script: renovate $RENOVATE_EXTRA_FLAG
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
files: .pre-commit-config.yaml
- id: trailing-whitespace
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 37.368.8
rev: 37.374.3
hooks:
- id: renovate-config-validator
- repo: local
Expand Down
25 changes: 20 additions & 5 deletions .renovaterc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"constraints": {
"pdm": "2.15.2",
"python": "==3.12"
},
"customManagers": [
{
"customType": "regex",
Expand Down Expand Up @@ -44,17 +48,29 @@
},
{
"customType": "regex",
"datasourceTemplate": "github-tags",
"depNameTemplate": "pdm-project/pdm",
"datasourceTemplate": "pypi",
"depNameTemplate": "pdm",
"description": "Match pdm version specified in setup-pdm GitHub Action",
"fileMatch": [
"^\\.github/workflows/.+\\.yml$",
"^template/.*\\.github.*/workflows/.+\\.yml(\\.jinja)?$"
],
"matchStrings": [
"uses: pdm-project/setup-pdm[\\s\\S]+?\\sversion: (?<currentValue>.*)\n"
]
},
{
"customType": "regex",
"datasourceTemplate": "pypi",
"depNameTemplate": "pdm",
"description": "Match pdm version specified in the renovate constraints",
"fileMatch": [
"^\\.renovaterc\\.json$",
"^template/\\.renovaterc\\.json\\.jinja$"
],
"versioningTemplate": "semver"
"matchStrings": [
"\"pdm\": \"(?<currentValue>.*)\""
]
},
{
"customType": "regex",
Expand Down Expand Up @@ -196,8 +212,7 @@
"pypi"
],
"matchDepNames": [
"pdm",
"pdm-project/pdm"
"pdm"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions docs/management/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The project template tracks the following dependencies:
1. Python packages installed with pip, pipx and asdf, listed in the README, DevContainer Dockerfile, GitHub Actions, GitLab CI/CD, ReadTheDocs configuration, Renovate configuration and documentation.
1. Debian packages installed in the DevContainer Dockerfile.
1. PDM version specified in the `pdm-project/setup-pdm` GitHub action.
1. PDM version specified in the renovate constraints.
1. NPM packages used with npx.
1. The project template itself.

Expand Down
2 changes: 1 addition & 1 deletion template/.pre-commit-config.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos:
files: .pre-commit-config.yaml
- id: trailing-whitespace
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 37.368.8
rev: 37.374.3
hooks:
- id: renovate-config-validator
- repo: local
Expand Down
27 changes: 22 additions & 5 deletions template/.renovaterc.json.jinja
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[% from pathjoin("includes", "version_compare.jinja") import version_higher_than -%]
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"constraints": {
"pdm": "2.15.2",
"python": "=={{ default_py }}"
},
"customManagers": [
{
"customType": "regex",
Expand Down Expand Up @@ -49,8 +53,8 @@
},
{
"customType": "regex",
"datasourceTemplate": "github-tags",
"depNameTemplate": "pdm-project/pdm",
"datasourceTemplate": "pypi",
"depNameTemplate": "pdm",
"description": "Match pdm version specified in setup-pdm GitHub Action",
"fileMatch": [
"^\\.github/workflows/.+\\.yml$"
Expand All @@ -60,8 +64,22 @@
],
"matchStrings": [
"uses: pdm-project/setup-pdm[\\s\\S]+?\\sversion: (?<currentValue>.*)\n"
]
},
{
"customType": "regex",
"datasourceTemplate": "pypi",
"depNameTemplate": "pdm",
"description": "Match pdm version specified in the renovate constraints",
"fileMatch": [
"^\\.renovaterc\\.json$"
[%- if project_name == "Serious Scaffold Python" %],
"^template/\\.renovaterc\\.json\\.jinja$"
[%- endif %]
],
"versioningTemplate": "semver"
"matchStrings": [
"\"pdm\": \"(?<currentValue>.*)\""
]
},
{
"customType": "regex",
Expand Down Expand Up @@ -209,8 +227,7 @@
"pypi"
],
"matchDepNames": [
"pdm",
"pdm-project/pdm"
"pdm"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
[%- else %]
RENOVATE_ENABLED_MANAGERS: '["pep621", "github-actions", "regex", "pre-commit"]'
[%- endif %]
RENOVATE_OPTIMIZE_FOR_DISABLED: "true"
RENOVATE_OPTIMIZE_FOR_DISABLED: 'true'
RENOVATE_PLATFORM: github
RENOVATE_REPOSITORIES: '["{{ '${{ github.repository }}' }}"]'
RENOVATE_REPOSITORY_CACHE: enabled
image: ghcr.io/renovatebot/renovate:37.368.8-full@sha256:ec42750b18504058611851753fb5822522c1999a39476eefc083be70f179a74e
options: "--user root"
image: ghcr.io/renovatebot/renovate:37.374.3@sha256:a12297dde4fad3d54111c3e4471aae726e7bc99bd407b74886394c41bc227250
options: '--user root'
runs-on: ubuntu-22.04
steps:
- run: env | sort
Expand Down Expand Up @@ -52,5 +52,5 @@ jobs:
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "*/15 0-3 * * 1"
- cron: '*/15 0-3 * * 1'
workflow_dispatch: null
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ renovate:
key: ${CI_COMMIT_REF_SLUG}-renovate
paths:
- renovate/cache/renovate/repository/
image: renovate/renovate:37.368.8-full@sha256:ec42750b18504058611851753fb5822522c1999a39476eefc083be70f179a74e
image: renovate/renovate:37.374.3@sha256:a12297dde4fad3d54111c3e4471aae726e7bc99bd407b74886394c41bc227250
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" && $PAT != null
script: renovate $RENOVATE_EXTRA_FLAG
Expand Down
1 change: 1 addition & 0 deletions template/docs/management/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The project template tracks the following dependencies:
1. Python packages installed with pip, pipx and asdf, listed in the README, DevContainer Dockerfile, GitHub Actions, GitLab CI/CD, ReadTheDocs configuration, Renovate configuration and documentation.
1. Debian packages installed in the DevContainer Dockerfile.
1. PDM version specified in the `pdm-project/setup-pdm` GitHub action.
1. PDM version specified in the renovate constraints.
1. NPM packages used with npx.
1. The project template itself.

Expand Down

0 comments on commit 6535f7d

Please sign in to comment.