From 79f5692c142498c1e302946517cda5b834fc1bef Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Tue, 16 Sep 2025 12:51:43 +0200 Subject: [PATCH 01/11] feat: Add action to run toxgen periodically --- .github/workflows/update-tox.yml | 100 +++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/update-tox.yml diff --git a/.github/workflows/update-tox.yml b/.github/workflows/update-tox.yml new file mode 100644 index 0000000000..8df382bf8a --- /dev/null +++ b/.github/workflows/update-tox.yml @@ -0,0 +1,100 @@ +name: Update tox.ini + +on: + schedule: + - cron: '23 3 * * 1' + +jobs: + update-tox: + name: Update tox.ini + runs-on: ubuntu-24.04 + + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout repo + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "'github-actions[bot]@users.noreply.github.com'" + + - name: Run generate-test-files.sh + run: | + set -e + sh scripts/generate-test-files.sh + + - name: Create branch + id: create-branch + run: | + COMMIT_TITLE="ci: Update test matrix with new releases" + DATE="date +%m/%d" + BRANCH_NAME="toxgen/update" + + git checkout -B "$BRANCH_NAME" + git add tox.ini + git commit -m "$COMMIT_TITLE" + git push origin "$BRANCH_NAME" --force + + echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT + echo "commit_title=$COMMIT_TITLE" >> $GITHUB_OUTPUT + echo "date=$DATE" >> $GITHUB_OUTPUT + + - name: Create pull request + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # 8.0.0 + with: + script: | + const branchName = '${{ steps.create-branch.outputs.branch_name }}'; + const commitTitle = '${{ steps.create-branch.outputs.commit_title }}'; + const date = '${{ steps.create-branch.outputs.date }}'; + + // Close existing toxgen PRs as they're now obsolete + + const { data: existingPRs } = await github.rest.pulls.list({ + owner: context.repo.owner, + repo: 'sentry-python', + head: `${context.repo.owner}:${branchName}`, + state: 'open' + }); + + existingPRs.forEach(pr => await github.rest.pulls.update({ + owner: context.repo.owner, + repo: 'sentry-python', + pull_number: pr.number, + state: 'closed', + })); + + const { data: pr } = await github.rest.pulls.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: commitTitle + ' (' + date + ')', + head: branchName, + base: '${{ github.ref_name }}', + body: `Update our test matrix with new releases of integrated frameworks and libraries. + + ## How it works + - Scan PyPI for all supported releases of all frameworks we have a dedicated test suite for. + - Pick a representative sample of releases to run our test suite against. We always test the latest and oldest supported version. + - Update tox.ini with the new releases. + + ## Action required + - If CI passes on this PR, it's safe to approve and merge. It means our integrations can handle new versions of frameworks that got pulled in. + - If CI doesn't pass on this PR, this points to an incompatibility of either our integration or our test setup with a new version of a framework. + - Check what the failures look like and either fix them, or update the [test config](scripts/populate_tox/config.py) and rerun (scripts/generate-test-files.sh)[scripts/generate-test-files.sh]. See [README.md](scripts/populate_tox/README.md) for what configuration options are available. + + This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).` + }); + + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + labels: ['Component: CI', 'Component: Tests'] + }); + + console.log(`Created PR #${pr.number}: ${pr.title}`); From 995066cc2c82f3f4dc4a22cc3cd9472a9401db8f Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Tue, 16 Sep 2025 13:16:25 +0200 Subject: [PATCH 02/11] improvements --- .github/workflows/update-tox.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-tox.yml b/.github/workflows/update-tox.yml index 8df382bf8a..458c17f9b9 100644 --- a/.github/workflows/update-tox.yml +++ b/.github/workflows/update-tox.yml @@ -1,19 +1,26 @@ name: Update tox.ini on: + workflow_dispatch: schedule: - cron: '23 3 * * 1' jobs: update-tox: name: Update tox.ini - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest + timeout-minutes: 10 permissions: contents: write pull-requests: write steps: + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.13 + - name: Checkout repo uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0 with: @@ -21,8 +28,8 @@ jobs: - name: Configure git run: | - git config user.name "github-actions[bot]" - git config user.email "'github-actions[bot]@users.noreply.github.com'" + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' - name: Run generate-test-files.sh run: | @@ -57,14 +64,14 @@ jobs: const { data: existingPRs } = await github.rest.pulls.list({ owner: context.repo.owner, - repo: 'sentry-python', + repo: context.repo.repo, head: `${context.repo.owner}:${branchName}`, state: 'open' }); existingPRs.forEach(pr => await github.rest.pulls.update({ owner: context.repo.owner, - repo: 'sentry-python', + repo: context.repo.repo, pull_number: pr.number, state: 'closed', })); From 31428f9a6eac6c31b9ad1452523704e0d6fe6d6b Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Tue, 16 Sep 2025 15:03:58 +0200 Subject: [PATCH 03/11] . --- .github/workflows/update-tox.yml | 43 +++++++++++++++++--------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/.github/workflows/update-tox.yml b/.github/workflows/update-tox.yml index 458c17f9b9..4b6f70995d 100644 --- a/.github/workflows/update-tox.yml +++ b/.github/workflows/update-tox.yml @@ -1,13 +1,14 @@ -name: Update tox.ini +name: Update test matrix on: workflow_dispatch: schedule: + # early Monday morning - cron: '23 3 * * 1' jobs: update-tox: - name: Update tox.ini + name: Update test matrix runs-on: ubuntu-latest timeout-minutes: 10 @@ -22,7 +23,7 @@ jobs: python-version: 3.13 - name: Checkout repo - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0 + uses: actions/checkout@v5.0.0 with: token: ${{ secrets.GITHUB_TOKEN }} @@ -40,7 +41,7 @@ jobs: id: create-branch run: | COMMIT_TITLE="ci: Update test matrix with new releases" - DATE="date +%m/%d" + DATE=`date +%m/%d` BRANCH_NAME="toxgen/update" git checkout -B "$BRANCH_NAME" @@ -53,7 +54,7 @@ jobs: echo "date=$DATE" >> $GITHUB_OUTPUT - name: Create pull request - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # 8.0.0 + uses: actions/github-script@v8.0.0 with: script: | const branchName = '${{ steps.create-branch.outputs.branch_name }}'; @@ -69,12 +70,14 @@ jobs: state: 'open' }); - existingPRs.forEach(pr => await github.rest.pulls.update({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: pr.number, - state: 'closed', - })); + for (const pr of existingPRs) { + await github.rest.pulls.update({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: pr.number, + state: 'closed' + }) + }; const { data: pr } = await github.rest.pulls.create({ owner: context.repo.owner, @@ -84,17 +87,17 @@ jobs: base: '${{ github.ref_name }}', body: `Update our test matrix with new releases of integrated frameworks and libraries. - ## How it works - - Scan PyPI for all supported releases of all frameworks we have a dedicated test suite for. - - Pick a representative sample of releases to run our test suite against. We always test the latest and oldest supported version. - - Update tox.ini with the new releases. + ## How it works + - Scan PyPI for all supported releases of all frameworks we have a dedicated test suite for. + - Pick a representative sample of releases to run our test suite against. We always test the latest and oldest supported version. + - Update tox.ini with the new releases. - ## Action required - - If CI passes on this PR, it's safe to approve and merge. It means our integrations can handle new versions of frameworks that got pulled in. - - If CI doesn't pass on this PR, this points to an incompatibility of either our integration or our test setup with a new version of a framework. - - Check what the failures look like and either fix them, or update the [test config](scripts/populate_tox/config.py) and rerun (scripts/generate-test-files.sh)[scripts/generate-test-files.sh]. See [README.md](scripts/populate_tox/README.md) for what configuration options are available. + ## Action required + - If CI passes on this PR, it's safe to approve and merge. It means our integrations can handle new versions of frameworks that got pulled in. + - If CI doesn't pass on this PR, this points to an incompatibility of either our integration or our test setup with a new version of a framework. + - Check what the failures look like and either fix them, or update the [test config](scripts/populate_tox/config.py) and rerun [scripts/generate-test-files.sh](scripts/generate-test-files.sh). See [README.md](scripts/populate_tox/README.md) for what configuration options are available. - This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).` + This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).`.replace(/^ {20}/gm, '') }); await github.rest.issues.addLabels({ From 97ea092bc2637706f428fe5af12a927689761c01 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Tue, 16 Sep 2025 15:05:52 +0200 Subject: [PATCH 04/11] . --- .github/workflows/update-tox.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/update-tox.yml b/.github/workflows/update-tox.yml index 4b6f70995d..135dd04ec1 100644 --- a/.github/workflows/update-tox.yml +++ b/.github/workflows/update-tox.yml @@ -106,5 +106,3 @@ jobs: issue_number: pr.number, labels: ['Component: CI', 'Component: Tests'] }); - - console.log(`Created PR #${pr.number}: ${pr.title}`); From 04be05dcf99017feb2f2c90d3a08ef30a956cc42 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Tue, 16 Sep 2025 15:39:25 +0200 Subject: [PATCH 05/11] . --- .github/workflows/update-tox.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/update-tox.yml b/.github/workflows/update-tox.yml index 135dd04ec1..711dc32147 100644 --- a/.github/workflows/update-tox.yml +++ b/.github/workflows/update-tox.yml @@ -45,7 +45,7 @@ jobs: BRANCH_NAME="toxgen/update" git checkout -B "$BRANCH_NAME" - git add tox.ini + git add --all git commit -m "$COMMIT_TITLE" git push origin "$BRANCH_NAME" --force @@ -87,17 +87,17 @@ jobs: base: '${{ github.ref_name }}', body: `Update our test matrix with new releases of integrated frameworks and libraries. - ## How it works - - Scan PyPI for all supported releases of all frameworks we have a dedicated test suite for. - - Pick a representative sample of releases to run our test suite against. We always test the latest and oldest supported version. - - Update tox.ini with the new releases. + ## How it works + - Scan PyPI for all supported releases of all frameworks we have a dedicated test suite for. + - Pick a representative sample of releases to run our test suite against. We always test the latest and oldest supported version. + - Update tox.ini with the new releases. - ## Action required - - If CI passes on this PR, it's safe to approve and merge. It means our integrations can handle new versions of frameworks that got pulled in. - - If CI doesn't pass on this PR, this points to an incompatibility of either our integration or our test setup with a new version of a framework. - - Check what the failures look like and either fix them, or update the [test config](scripts/populate_tox/config.py) and rerun [scripts/generate-test-files.sh](scripts/generate-test-files.sh). See [README.md](scripts/populate_tox/README.md) for what configuration options are available. + ## Action required + - If CI passes on this PR, it's safe to approve and merge. It means our integrations can handle new versions of frameworks that got pulled in. + - If CI doesn't pass on this PR, this points to an incompatibility of either our integration or our test setup with a new version of a framework. + - Check what the failures look like and either fix them, or update the [test config](scripts/populate_tox/config.py) and rerun [scripts/generate-test-files.sh](scripts/generate-test-files.sh). See [README.md](scripts/populate_tox/README.md) for what configuration options are available. - This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).`.replace(/^ {20}/gm, '') + This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).` }); await github.rest.issues.addLabels({ From f922f374e20cba719796becc7e42182639d132cd Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Tue, 16 Sep 2025 15:43:22 +0200 Subject: [PATCH 06/11] . --- .github/workflows/update-tox.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/update-tox.yml b/.github/workflows/update-tox.yml index 711dc32147..91bbbea5b6 100644 --- a/.github/workflows/update-tox.yml +++ b/.github/workflows/update-tox.yml @@ -87,17 +87,17 @@ jobs: base: '${{ github.ref_name }}', body: `Update our test matrix with new releases of integrated frameworks and libraries. - ## How it works - - Scan PyPI for all supported releases of all frameworks we have a dedicated test suite for. - - Pick a representative sample of releases to run our test suite against. We always test the latest and oldest supported version. - - Update tox.ini with the new releases. + ## How it works + - Scan PyPI for all supported releases of all frameworks we have a dedicated test suite for. + - Pick a representative sample of releases to run our test suite against. We always test the latest and oldest supported version. + - Update tox.ini with the new releases. - ## Action required - - If CI passes on this PR, it's safe to approve and merge. It means our integrations can handle new versions of frameworks that got pulled in. - - If CI doesn't pass on this PR, this points to an incompatibility of either our integration or our test setup with a new version of a framework. - - Check what the failures look like and either fix them, or update the [test config](scripts/populate_tox/config.py) and rerun [scripts/generate-test-files.sh](scripts/generate-test-files.sh). See [README.md](scripts/populate_tox/README.md) for what configuration options are available. + ## Action required + - If CI passes on this PR, it's safe to approve and merge. It means our integrations can handle new versions of frameworks that got pulled in. + - If CI doesn't pass on this PR, this points to an incompatibility of either our integration or our test setup with a new version of a framework. + - Check what the failures look like and either fix them, or update the [test config](scripts/populate_tox/config.py) and rerun [scripts/generate-test-files.sh](scripts/generate-test-files.sh). See [README.md](scripts/populate_tox/README.md) for what configuration options are available. - This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).` + This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).`.replace('') }); await github.rest.issues.addLabels({ From 297a85b6d415eafde9bcdec8390a35276500e11f Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Tue, 16 Sep 2025 15:50:11 +0200 Subject: [PATCH 07/11] idk --- .github/workflows/update-tox.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-tox.yml b/.github/workflows/update-tox.yml index 91bbbea5b6..b228a34702 100644 --- a/.github/workflows/update-tox.yml +++ b/.github/workflows/update-tox.yml @@ -97,7 +97,7 @@ jobs: - If CI doesn't pass on this PR, this points to an incompatibility of either our integration or our test setup with a new version of a framework. - Check what the failures look like and either fix them, or update the [test config](scripts/populate_tox/config.py) and rerun [scripts/generate-test-files.sh](scripts/generate-test-files.sh). See [README.md](scripts/populate_tox/README.md) for what configuration options are available. - This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).`.replace('') + This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).`.replace(/^ {16}/gm, '') }); await github.rest.issues.addLabels({ From 0b84d0c7ae9f61339aa47affd0bcb9d674ca56f0 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Tue, 16 Sep 2025 15:53:58 +0200 Subject: [PATCH 08/11] . --- .github/workflows/update-tox.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-tox.yml b/.github/workflows/update-tox.yml index b228a34702..99d16364fc 100644 --- a/.github/workflows/update-tox.yml +++ b/.github/workflows/update-tox.yml @@ -97,7 +97,7 @@ jobs: - If CI doesn't pass on this PR, this points to an incompatibility of either our integration or our test setup with a new version of a framework. - Check what the failures look like and either fix them, or update the [test config](scripts/populate_tox/config.py) and rerun [scripts/generate-test-files.sh](scripts/generate-test-files.sh). See [README.md](scripts/populate_tox/README.md) for what configuration options are available. - This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).`.replace(/^ {16}/gm, '') + This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).`.replace(/^ {14}/gm, '') }); await github.rest.issues.addLabels({ From 56b0c2715848f6a675abcb5cb6e5a33ba77cb9b5 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Tue, 16 Sep 2025 15:58:47 +0200 Subject: [PATCH 09/11] . --- .github/workflows/update-tox.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/update-tox.yml b/.github/workflows/update-tox.yml index 99d16364fc..bb1b809e8d 100644 --- a/.github/workflows/update-tox.yml +++ b/.github/workflows/update-tox.yml @@ -60,6 +60,19 @@ jobs: const branchName = '${{ steps.create-branch.outputs.branch_name }}'; const commitTitle = '${{ steps.create-branch.outputs.commit_title }}'; const date = '${{ steps.create-branch.outputs.date }}'; + const prBody = `Update our test matrix with new releases of integrated frameworks and libraries. + + ## How it works + - Scan PyPI for all supported releases of all frameworks we have a dedicated test suite for. + - Pick a representative sample of releases to run our test suite against. We always test the latest and oldest supported version. + - Update tox.ini with the new releases. + + ## Action required + - If CI passes on this PR, it's safe to approve and merge. It means our integrations can handle new versions of frameworks that got pulled in. + - If CI doesn't pass on this PR, this points to an incompatibility of either our integration or our test setup with a new version of a framework. + - Check what the failures look like and either fix them, or update the [test config](scripts/populate_tox/config.py) and rerun [scripts/generate-test-files.sh](scripts/generate-test-files.sh). See [README.md](scripts/populate_tox/README.md) for what configuration options are available. + + This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).`.replace(/^ {16}/gm, '') // Close existing toxgen PRs as they're now obsolete @@ -85,19 +98,7 @@ jobs: title: commitTitle + ' (' + date + ')', head: branchName, base: '${{ github.ref_name }}', - body: `Update our test matrix with new releases of integrated frameworks and libraries. - - ## How it works - - Scan PyPI for all supported releases of all frameworks we have a dedicated test suite for. - - Pick a representative sample of releases to run our test suite against. We always test the latest and oldest supported version. - - Update tox.ini with the new releases. - - ## Action required - - If CI passes on this PR, it's safe to approve and merge. It means our integrations can handle new versions of frameworks that got pulled in. - - If CI doesn't pass on this PR, this points to an incompatibility of either our integration or our test setup with a new version of a framework. - - Check what the failures look like and either fix them, or update the [test config](scripts/populate_tox/config.py) and rerun [scripts/generate-test-files.sh](scripts/generate-test-files.sh). See [README.md](scripts/populate_tox/README.md) for what configuration options are available. - - This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).`.replace(/^ {14}/gm, '') + body: prBody, }); await github.rest.issues.addLabels({ From f1733d4b9297938fe43dffc5c94c33d8eb3253ae Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Wed, 17 Sep 2025 08:55:21 +0200 Subject: [PATCH 10/11] Apply suggestions from code review Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com> --- .github/workflows/update-tox.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-tox.yml b/.github/workflows/update-tox.yml index bb1b809e8d..d7ec216f02 100644 --- a/.github/workflows/update-tox.yml +++ b/.github/workflows/update-tox.yml @@ -30,7 +30,7 @@ jobs: - name: Configure git run: | git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - name: Run generate-test-files.sh run: | @@ -40,7 +40,7 @@ jobs: - name: Create branch id: create-branch run: | - COMMIT_TITLE="ci: Update test matrix with new releases" + COMMIT_TITLE="ci: 🤖 Update test matrix with new releases" DATE=`date +%m/%d` BRANCH_NAME="toxgen/update" @@ -72,7 +72,8 @@ jobs: - If CI doesn't pass on this PR, this points to an incompatibility of either our integration or our test setup with a new version of a framework. - Check what the failures look like and either fix them, or update the [test config](scripts/populate_tox/config.py) and rerun [scripts/generate-test-files.sh](scripts/generate-test-files.sh). See [README.md](scripts/populate_tox/README.md) for what configuration options are available. - This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml).`.replace(/^ {16}/gm, '') + _____________________ + _🤖 This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml)._`.replace(/^ {16}/gm, '') // Close existing toxgen PRs as they're now obsolete From 09a611fd5e43f3f36fa0388bddfb9c3480f0bb1b Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Wed, 17 Sep 2025 09:02:34 +0200 Subject: [PATCH 11/11] also link to tox.ini --- .github/workflows/update-tox.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-tox.yml b/.github/workflows/update-tox.yml index d7ec216f02..cfe98bbfe0 100644 --- a/.github/workflows/update-tox.yml +++ b/.github/workflows/update-tox.yml @@ -65,7 +65,7 @@ jobs: ## How it works - Scan PyPI for all supported releases of all frameworks we have a dedicated test suite for. - Pick a representative sample of releases to run our test suite against. We always test the latest and oldest supported version. - - Update tox.ini with the new releases. + - Update [tox.ini](tox.ini) with the new releases. ## Action required - If CI passes on this PR, it's safe to approve and merge. It means our integrations can handle new versions of frameworks that got pulled in. @@ -73,6 +73,7 @@ jobs: - Check what the failures look like and either fix them, or update the [test config](scripts/populate_tox/config.py) and rerun [scripts/generate-test-files.sh](scripts/generate-test-files.sh). See [README.md](scripts/populate_tox/README.md) for what configuration options are available. _____________________ + _🤖 This PR was automatically created using [a GitHub action](.github/workflows/update-tox.yml)._`.replace(/^ {16}/gm, '') // Close existing toxgen PRs as they're now obsolete