From e7752e81356dbbe485f394244b6c6163aff5f5c5 Mon Sep 17 00:00:00 2001 From: Bowen Liang Date: Fri, 14 Jun 2024 20:54:07 +0800 Subject: [PATCH] chore: development script for syncing Poetry lockfile (#5170) --- .github/workflows/api-tests.yml | 4 +++- .github/workflows/style.yml | 1 + dev/sync-poetry | 15 +++++++++++++++ dev/update-poetry | 13 +++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100755 dev/sync-poetry create mode 100755 dev/update-poetry diff --git a/.github/workflows/api-tests.yml b/.github/workflows/api-tests.yml index cff98db7e4..4af4daadeb 100644 --- a/.github/workflows/api-tests.yml +++ b/.github/workflows/api-tests.yml @@ -107,7 +107,9 @@ jobs: api/poetry.lock - name: Poetry check - run: poetry check -C api + run: | + poetry check -C api + poetry show -C api - name: Install dependencies run: poetry install -C api --with dev diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 160641fdf0..cb5400b918 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -100,6 +100,7 @@ jobs: **.yaml **.yml Dockerfile + dev/** - name: Super-linter uses: super-linter/super-linter/slim@v6 diff --git a/dev/sync-poetry b/dev/sync-poetry new file mode 100755 index 0000000000..2dd4dd4fc3 --- /dev/null +++ b/dev/sync-poetry @@ -0,0 +1,15 @@ +#!/bin/bash + +# rely on `poetry` in path +if ! command -v poetry &> /dev/null; then + echo "Installing Poetry ..." + pip install poetry +fi + +# check poetry.lock in sync with pyproject.toml +poetry check -C api --lock +if [ $? -ne 0 ]; then + # update poetry.lock + # refreshing lockfile only without updating locked versions + poetry lock -C api --no-update +fi diff --git a/dev/update-poetry b/dev/update-poetry new file mode 100755 index 0000000000..362a5895b1 --- /dev/null +++ b/dev/update-poetry @@ -0,0 +1,13 @@ +#!/bin/bash + +# rely on `poetry` in path +if ! command -v poetry &> /dev/null; then + echo "Installing Poetry ..." + pip install poetry +fi + +# refreshing lockfile, updating locked versions +poetry update -C api + +# check poetry.lock in sync with pyproject.toml +poetry check -C api --lock