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

Commit

Permalink
Check the lockfile is version 2.0
Browse files Browse the repository at this point in the history
Might one day incorporate other checks like #14742
  • Loading branch information
David Robertson committed Jan 17, 2023
1 parent b7137a2 commit b6fddbe
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .ci/scripts/check_lockfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#! /usr/bin/env python
import sys

if sys.version_info < (3, 11):
raise RuntimeError("Requires at least Python 3.11, to import tomllib")

import tomllib

with open("poetry.lock", "rb") as f:
lockfile = tomllib.load(f)

try:
lock_version = lockfile["metadata"]["lock-version"]
assert lock_version == "2.0"
except Exception:
print(
"""\
Lockfile is not version 2.0. You probably need to upgrade poetry on your local box
and re-run `poetry lock --no-update`. See the Poetry cheat sheet at
https://matrix-org.github.io/synapse/develop/development/dependencies.html
"""
)
raise
9 changes: 9 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ jobs:
- run: "pip install 'click==8.1.1' 'GitPython>=3.1.20'"
- run: scripts-dev/check_schema_delta.py --force-colors

check-lockfile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- run: .ci/scripts/check_lockfile.py
lint:
uses: "matrix-org/backend-meta/.github/workflows/python-poetry-ci.yml@v2"
with:
Expand Down Expand Up @@ -163,6 +171,7 @@ jobs:
- lint-pydantic
- check-sampleconfig
- check-schema-delta
- check-lockfile
- lint-clippy
- lint-rustfmt
runs-on: ubuntu-latest
Expand Down

0 comments on commit b6fddbe

Please sign in to comment.