Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 33 additions & 23 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
version: 2
# One grouped pull request per ecosystem per week, so updates land together and
# CI runs once per batch instead of once per package.
# One weekly pull request for every ecosystem (GitHub Actions, Cargo, npm), so CI runs
# once per week's batch and it merges once. Checked by .github/tests/test_dependabot.py.
multi-ecosystem-groups:
weekly:
schedule:
interval: "weekly"
day: "monday"

updates:
- package-ecosystem: github-actions
directory: /
schedule: { interval: weekly }
groups:
actions: { patterns: ["*"] }
- package-ecosystem: cargo
directory: /
schedule: { interval: weekly }
groups:
cargo: { patterns: ["*"], update-types: [minor, patch] }
- package-ecosystem: npm
directory: /tools
schedule: { interval: weekly }
groups:
site-tools: { patterns: ["*"] }
- package-ecosystem: npm
directory: /integrations/vscode
schedule: { interval: weekly }
groups:
vscode: { patterns: ["*"] }
- package-ecosystem: "github-actions"
directory: "/"
multi-ecosystem-group: "weekly"
patterns: ["*"]
# Wait before proposing a new version: a hijacked release is usually found and
# pulled within days. Security updates are not delayed.
cooldown:
default-days: 7
- package-ecosystem: "cargo"
directory: "/"
multi-ecosystem-group: "weekly"
patterns: ["*"]
cooldown:
default-days: 7
ignore:
# The extension's minimum VS Code version; raise it deliberately.
# Minor and patch only, as before: Cargo majors are raised by hand.
- dependency-name: "*"
update-types: ["version-update:semver-major"]
- package-ecosystem: "npm"
directories: ["/tools", "/integrations/vscode"]
multi-ecosystem-group: "weekly"
patterns: ["*"]
cooldown:
default-days: 7
ignore:
# The VS Code extension's minimum VS Code version; raise it deliberately.
- dependency-name: "@types/vscode"
56 changes: 56 additions & 0 deletions .github/tests/test_dependabot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"""Dependabot sends one weekly pull request for every ecosystem (#40).

Every `updates` entry must belong to the `weekly` multi-ecosystem group with
`patterns: ["*"]` and no schedule or groups of its own, keep a 7-day cooldown, and
keep the rules it had before the move: Cargo minor and patch only, and the
`@types/vscode` ignore. The file is also valid against
https://json.schemastore.org/dependabot-2.0.json (checked when it was written; CI
stays offline).
"""
import pathlib
import unittest

import yaml

CONFIG = pathlib.Path(__file__).resolve().parents[1] / "dependabot.yml"


class DependabotConfig(unittest.TestCase):
def setUp(self):
self.cfg = yaml.safe_load(CONFIG.read_text())

def test_one_weekly_group(self):
groups = self.cfg["multi-ecosystem-groups"]
self.assertEqual(list(groups), ["weekly"])
self.assertEqual(groups["weekly"]["schedule"], {"interval": "weekly", "day": "monday"})

def test_every_entry_is_in_the_weekly_group(self):
for entry in self.cfg["updates"]:
with self.subTest(entry=entry["package-ecosystem"]):
self.assertEqual(entry.get("multi-ecosystem-group"), "weekly")
self.assertEqual(entry.get("patterns"), ["*"])
self.assertNotIn("schedule", entry)
self.assertNotIn("groups", entry)
self.assertEqual(entry.get("cooldown", {}).get("default-days"), 7)

def test_ecosystems_and_folders_are_unchanged(self):
seen = set()
for entry in self.cfg["updates"]:
dirs = entry.get("directories") or [entry["directory"]]
seen |= {(entry["package-ecosystem"], d) for d in dirs}
self.assertEqual(
seen,
{("github-actions", "/"), ("cargo", "/"), ("npm", "/tools"), ("npm", "/integrations/vscode")},
)

def test_previous_rules_are_kept(self):
by = {e["package-ecosystem"]: e for e in self.cfg["updates"]}
self.assertIn(
{"dependency-name": "*", "update-types": ["version-update:semver-major"]},
by["cargo"].get("ignore", []),
)
self.assertIn({"dependency-name": "@types/vscode"}, by["npm"].get("ignore", []))


if __name__ == "__main__":
unittest.main()
4 changes: 4 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
- run: cargo xtask schema --check
- name: Action script tests
run: python3 -m unittest discover -s packaging/action -v
- name: Dependabot configuration test
run: |
python3 -c "import yaml" 2>/dev/null || python3 -m pip install --user --break-system-packages pyyaml==6.0.2
python3 -m unittest discover -s .github/tests -v

test:
strategy:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ the JSON schema is versioned separately (`schema_version` in round files).

## Unreleased

### Maintenance

- Dependabot sends one weekly pull request for every ecosystem (GitHub Actions,
Cargo, npm) instead of up to four, waits 7 days before proposing a new version
(security updates are not delayed), and still updates Cargo by minor and patch only.
A test in CI keeps the configuration that way; `docs/releasing.md` describes it.

### Interop with overfull

- `docs/interop.md` §6 records that overfull 3.3.0 fixed its differences O1 and O2,
Expand Down
18 changes: 18 additions & 0 deletions docs/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ of release files with:
python3 packaging/check-release-files.py <folder> <version>
```

## Dependency updates

Dependabot opens one pull request a week, on Monday, for every ecosystem together:
GitHub Actions, Cargo, and npm in `tools/` and `integrations/vscode/`
(`.github/dependabot.yml`, one multi-ecosystem group named `weekly`). CI runs once on
the batch and it merges once. Nothing merges it automatically; review and merge it
like any other pull request.

- New versions wait 7 days before Dependabot proposes them (`cooldown`), since a
hijacked release is usually found and pulled within days. Security updates are
not delayed.
- Cargo gets minor and patch updates only; raise a Cargo major by hand.
- `@types/vscode` is never updated automatically: it sets the extension's minimum
VS Code version, which is raised on purpose.

`.github/tests/test_dependabot.py` (run by the lint job) keeps every entry in the
`weekly` group and keeps these rules.

## Optional: Homebrew tap

A tap is an ordinary repository on the same GitHub account, so no new account is
Expand Down
Loading