Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 9382733

Browse files
author
David Robertson
committed
Check the lockfile is version 2.0
Might one day incorporate other checks like #14742
1 parent b7137a2 commit 9382733

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.ci/scripts/check_lockfile.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#! /usr/bin/env python
2+
import sys
3+
4+
if sys.version_info < (3, 11):
5+
raise RuntimeError("Requires at least Python 3.11, to import tomllib")
6+
7+
import tomllib
8+
9+
with open("poetry.lock", "rb") as f:
10+
lockfile = tomllib.load(f)
11+
12+
try:
13+
lock_version = lockfile["metadata"]["lock-version"]
14+
assert lock_version == "2.0"
15+
except Exception:
16+
print(
17+
"""\
18+
Lockfile is not version 2.0. You probably need to upgrade poetry on your local box
19+
and re-run `poetry lock --no-update`. See the Poetry cheat sheet at
20+
https://matrix-org.github.io/synapse/develop/development/dependencies.html
21+
"""
22+
)
23+
raise

.github/workflows/tests.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ jobs:
5151
- run: "pip install 'click==8.1.1' 'GitPython>=3.1.20'"
5252
- run: scripts-dev/check_schema_delta.py --force-colors
5353

54+
check-lockfile:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v3
58+
- uses: actions/setup-python@v4
59+
with:
60+
python-version: "3.x"
61+
- run: .ci/scripts/check_lockfile.py
5462
lint:
5563
uses: "matrix-org/backend-meta/.github/workflows/python-poetry-ci.yml@v2"
5664
with:
@@ -163,6 +171,7 @@ jobs:
163171
- lint-pydantic
164172
- check-sampleconfig
165173
- check-schema-delta
174+
- check-lockfile
166175
- lint-clippy
167176
- lint-rustfmt
168177
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)