File size: 2,075 Bytes
314b695
 
 
 
 
 
 
 
 
3a1fd74
5afff31
28d8f0a
a90c881
28d8f0a
314b695
a90c881
314b695
 
a90c881
314b695
 
 
 
 
 
 
a90c881
314b695
a90c881
314b695
a90c881
314b695
a90c881
314b695
a90c881
 
 
 
e7941a7
a90c881
5419725
a634267
 
14359f9
 
7135815
14359f9
7135815
a634267
7135815
a90c881
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: PySR backend update
on:
  schedule:
    - cron: '00 00 * * *'
  workflow_dispatch:
jobs:
  update_compat:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: 3.12
          cache: pip

      - name: "Install dependencies"
        run: |
          python -m pip install --upgrade pip
          pip install tomlkit

      - name: "Get SymbolicRegression.jl latest version"
        id: get-latest
        run: |
          cd $(mktemp -d)
          git clone https://github.com/MilesCranmer/SymbolicRegression.jl
          cd SymbolicRegression.jl
          echo "version=$(git describe --tags --match='v*' --abbrev=0 | sed 's/^v//')" >> $GITHUB_OUTPUT

      - name: "Update SymbolicRegression.jl version in PySR"
        run: |
          python .github/workflows/update_backend_version.py ${{ steps.get-latest.outputs.version }}

      - name: "Restore changes if no diff to `pysr/juliapkg.json`"
        run: |
          if git diff --quiet pysr/juliapkg.json; then
            echo "No changes to pysr/juliapkg.json. Restoring changes."
            git restore pyproject.toml
          fi

      - name: "Create PR if necessary"
        uses: peter-evans/create-pull-request@v6
        with:
          token: ${{ secrets.REPO_SCOPED_TOKEN }}
          title: "Automated update to backend: 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 }}"
          add-paths: |
            pyproject.toml
            pysr/juliapkg.json