From 0e8a0943fe978cac83f38b06b927e166a5712051 Mon Sep 17 00:00:00 2001 From: MilesCranmerBot Date: Mon, 30 Mar 2026 16:05:26 +0000 Subject: [PATCH] fix: update backend bump automation Co-authored-by: Miles Cranmer --- .github/workflows/CI.yml | 1 + .github/workflows/CI_Windows.yml | 1 + .github/workflows/CI_apptainer.yml | 1 + .github/workflows/CI_docker.yml | 1 + .github/workflows/CI_mac.yml | 1 + .github/workflows/codeql-analysis.yml | 1 + .github/workflows/update_backend.yml | 28 ++++++++++++++++++--- .github/workflows/update_backend_version.py | 15 ++++++++--- 8 files changed, 43 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 12faec55d..26c091461 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,6 +13,7 @@ on: - 'master' paths: - '**' + workflow_dispatch: permissions: contents: write diff --git a/.github/workflows/CI_Windows.yml b/.github/workflows/CI_Windows.yml index 01d201701..74056e8ab 100644 --- a/.github/workflows/CI_Windows.yml +++ b/.github/workflows/CI_Windows.yml @@ -13,6 +13,7 @@ on: - 'master' paths: - '**' + workflow_dispatch: jobs: test: diff --git a/.github/workflows/CI_apptainer.yml b/.github/workflows/CI_apptainer.yml index f9ee538e3..015f0685d 100644 --- a/.github/workflows/CI_apptainer.yml +++ b/.github/workflows/CI_apptainer.yml @@ -13,6 +13,7 @@ on: - 'master' paths: - '**' + workflow_dispatch: jobs: test: diff --git a/.github/workflows/CI_docker.yml b/.github/workflows/CI_docker.yml index 7e61ee306..7e06a89ea 100644 --- a/.github/workflows/CI_docker.yml +++ b/.github/workflows/CI_docker.yml @@ -13,6 +13,7 @@ on: - 'master' paths: - '**' + workflow_dispatch: jobs: test: diff --git a/.github/workflows/CI_mac.yml b/.github/workflows/CI_mac.yml index 20bf390cf..53a93af4a 100644 --- a/.github/workflows/CI_mac.yml +++ b/.github/workflows/CI_mac.yml @@ -13,6 +13,7 @@ on: - 'master' paths: - '**' + workflow_dispatch: jobs: test: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2f61639b3..3a32749de 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -8,6 +8,7 @@ on: branches: [ "master" ] schedule: - cron: '28 17 * * 1' + workflow_dispatch: jobs: analyze: diff --git a/.github/workflows/update_backend.yml b/.github/workflows/update_backend.yml index 5d57783a5..ea9c051e4 100644 --- a/.github/workflows/update_backend.yml +++ b/.github/workflows/update_backend.yml @@ -3,6 +3,12 @@ on: schedule: - cron: '00 00 * * *' workflow_dispatch: + +permissions: + contents: write + pull-requests: write + actions: write + jobs: update_compat: runs-on: ubuntu-latest @@ -34,20 +40,36 @@ jobs: run: | if git diff --quiet pysr/juliapkg.json; then echo "No changes to pysr/juliapkg.json. Restoring changes." - git restore pyproject.toml + git restore pyproject.toml .release-please-manifest.json fi - name: "Create PR if necessary" + id: cpr uses: peter-evans/create-pull-request@v8 with: branch: backend-update/v${{ steps.get-latest.outputs.version }} - title: "Automated update to backend: v${{ steps.get-latest.outputs.version }}" + title: "chore: update backend to v${{ steps.get-latest.outputs.version }}" body: | This PR was automatically generated by the GitHub Action `.github/workflows/update-backend.yml` It updates the backend version to v${{ steps.get-latest.outputs.version }}. For a full description of the changes, see the backend changelog: [v${{ steps.get-latest.outputs.version }}](https://github.com/MilesCranmer/SymbolicRegression.jl/releases/tag/v${{ steps.get-latest.outputs.version }}). delete-branch: true - commit-message: "Update backend version to v${{ steps.get-latest.outputs.version }}" + commit-message: "chore: update backend to v${{ steps.get-latest.outputs.version }}" add-paths: | + .release-please-manifest.json pyproject.toml pysr/juliapkg.json + + - name: "Trigger CI workflows (backend update PR)" + if: steps.cpr.outputs.pull-request-number != '' + env: + GH_TOKEN: ${{ github.token }} + run: | + ref="backend-update/v${{ steps.get-latest.outputs.version }}" + gh workflow run "Linux" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true + gh workflow run "Windows" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true + gh workflow run "macOS" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true + gh workflow run "Docker" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true + gh workflow run "Apptainer" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true + gh workflow run "Documentation" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true + gh workflow run "CodeQL" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true diff --git a/.github/workflows/update_backend_version.py b/.github/workflows/update_backend_version.py index 301896532..dd6c79123 100644 --- a/.github/workflows/update_backend_version.py +++ b/.github/workflows/update_backend_version.py @@ -9,8 +9,10 @@ assert not new_backend_version.startswith("v"), "Version should not start with 'v'" -pyproject_toml = Path(__file__).parent / ".." / ".." / "pyproject.toml" -juliapkg_json = Path(__file__).parent / ".." / ".." / "pysr" / "juliapkg.json" +repo_root = Path(__file__).parent / ".." / ".." +pyproject_toml = repo_root / "pyproject.toml" +juliapkg_json = repo_root / "pysr" / "juliapkg.json" +release_please_manifest = repo_root / ".release-please-manifest.json" with open(pyproject_toml) as toml_file: pyproject_data = tomlkit.parse(toml_file.read()) @@ -18,6 +20,9 @@ with open(juliapkg_json) as f: juliapkg_data = json.load(f) +with open(release_please_manifest) as f: + release_please_manifest_data = json.load(f) + current_version = pyproject_data["project"]["version"] parts = current_version.split(".") @@ -52,6 +57,7 @@ new_version = f"{major}.{minor}.{new_patch}{new_suffix}{extra_parts}" pyproject_data["project"]["version"] = new_version +release_please_manifest_data["."] = new_version # Update backend - maintain current format (either "rev" or "version") backend_pkg = juliapkg_data["packages"]["SymbolicRegression"] @@ -69,5 +75,8 @@ with open(juliapkg_json, "w") as f: json.dump(juliapkg_data, f, indent=4) - # Ensure ends with newline + f.write("\n") + +with open(release_please_manifest, "w") as f: + json.dump(release_please_manifest_data, f, indent=2) f.write("\n")