From d0aab9fc20ac27af8d4f2bc8987daa417dfe42da Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Wed, 19 Feb 2025 16:51:46 +0100 Subject: [PATCH 1/2] Fix sync recipes and add base `justfile` Both the justfile and the pre-commit configuration for the `pr-check` sync were broken: * justfiles run recipes one line at a time in a fresh shell, so the venv activation was not working * the pre-commit config was relying on an installed `ruamel.yaml` pakcage, but the default one installable via `apt` on Ubuntu 24.04 is old and generates different output (with formatting differences). Now: * the venv dance is put in a separate bash script * both just and pre-commit will use that same script, so both problems will be fixed As a bonus, a root `justfile` is added exposing the `update-pr-checks` recipes plus a `build` one. Running `just` without arguments will also now call the default `sync` recipes that will call both of the above. --- .pre-commit-config.yaml | 2 +- justfile | 7 +++++++ pr-checks/justfile | 7 +------ pr-checks/sync.sh | 9 +++++++++ 4 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 justfile create mode 100755 pr-checks/sync.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 421720e468..e468c47091 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,5 +16,5 @@ repos: name: Synchronize PR check workflows files: ^.github/workflows/__.*\.yml$|^pr-checks language: system - entry: python3 pr-checks/sync.py + entry: pr-checks/sync.sh pass_filenames: false diff --git a/justfile b/justfile new file mode 100644 index 0000000000..98440d2abd --- /dev/null +++ b/justfile @@ -0,0 +1,7 @@ +sync: build update-pr-checks + +update-pr-checks: + pr-checks/sync.sh + +build: + npm run build diff --git a/pr-checks/justfile b/pr-checks/justfile index 00432c0ff4..245ca0a6a7 100644 --- a/pr-checks/justfile +++ b/pr-checks/justfile @@ -1,6 +1 @@ -# Perform all necessary steps to update the PR checks -update-pr-checks: - python3 -m venv env - source env/bin/activate - pip3 install ruamel.yaml - python3 sync.py +set fallback := true diff --git a/pr-checks/sync.sh b/pr-checks/sync.sh new file mode 100755 index 0000000000..a2db197426 --- /dev/null +++ b/pr-checks/sync.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e + +cd "$(dirname "$0")" +python3 -m venv env +source env/bin/activate +pip3 install ruamel.yaml +python3 sync.py + From ff50469ca0faa9bd857647ad61e318d5e2b46a99 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Wed, 19 Feb 2025 17:13:51 +0100 Subject: [PATCH 2/2] Add comments to the justfile --- justfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/justfile b/justfile index 98440d2abd..9bc9831373 100644 --- a/justfile +++ b/justfile @@ -1,7 +1,10 @@ +# Sync generated files (javascript and PR checks) sync: build update-pr-checks +# Perform all necessary steps to update the PR checks update-pr-checks: pr-checks/sync.sh +# Transpile typescript code into javascript build: npm run build