From 407cb3162e6c9feb4428c52475cf48e5c6e5c559 Mon Sep 17 00:00:00 2001 From: MaxenceGollier Date: Mon, 27 Apr 2026 09:36:57 -0400 Subject: [PATCH 1/3] Update breakage: use organization-wide workflow --- .breakage/Project.toml | 3 - .breakage/get_jso_users.jl | 18 --- .github/workflows/Breakage.yml | 208 +------------------------- .github/workflows/CommentBreakage.yml | 11 ++ 4 files changed, 15 insertions(+), 225 deletions(-) delete mode 100644 .breakage/Project.toml delete mode 100644 .breakage/get_jso_users.jl create mode 100644 .github/workflows/CommentBreakage.yml diff --git a/.breakage/Project.toml b/.breakage/Project.toml deleted file mode 100644 index 7f17b557..00000000 --- a/.breakage/Project.toml +++ /dev/null @@ -1,3 +0,0 @@ -[deps] -GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26" -PkgDeps = "839e9fc8-855b-5b3c-a3b7-2833d3dd1f59" diff --git a/.breakage/get_jso_users.jl b/.breakage/get_jso_users.jl deleted file mode 100644 index 0d87f552..00000000 --- a/.breakage/get_jso_users.jl +++ /dev/null @@ -1,18 +0,0 @@ -import GitHub, PkgDeps # both export users() - -length(ARGS) >= 1 || error("specify at least one JSO package as argument") - -jso_repos, _ = GitHub.repos("JuliaSmoothOptimizers") -jso_names = [splitext(x.name)[1] for x ∈ jso_repos] - -name = splitext(ARGS[1])[1] -name ∈ jso_names || error("argument should be one of ", jso_names) - -dependents = String[] -try - global dependents = filter(x -> x ∈ jso_names, PkgDeps.users(name)) -catch e - # package not registered; don't insert into dependents -end - -println(dependents) diff --git a/.github/workflows/Breakage.yml b/.github/workflows/Breakage.yml index 5b8be90b..9a4b1b5b 100644 --- a/.github/workflows/Breakage.yml +++ b/.github/workflows/Breakage.yml @@ -1,207 +1,7 @@ -# Ref: https://securitylab.github.com/research/github-actions-preventing-pwn-requests name: Breakage - -# read-only repo token -# no access to secrets on: - pull_request: - + pull_request: + types: [opened, synchronize, reopened] jobs: - # Build dynamically the matrix on which the "break" job will run. - # The matrix contains the packages that depend on ${{ env.pkg }}. - # Job "setup_matrix" outputs variable "matrix", which is in turn - # the output of the "getmatrix" step. - # The contents of "matrix" is a JSON description of a matrix used - # in the next step. It has the form - # { - # "pkg": [ - # "PROPACK", - # "LLSModels", - # "FletcherPenaltySolver" - # ] - # } - setup_matrix: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.getmatrix.outputs.matrix }} - env: - pkg: ${{ github.event.repository.name }} - steps: - - uses: actions/checkout@v6 - - uses: julia-actions/setup-julia@v2 - with: - version: 1 - arch: x64 - - id: getmatrix - run: | - julia -e 'using Pkg; Pkg.Registry.add(RegistrySpec(url = "https://github.com/JuliaRegistries/General.git"))' - julia --project=.breakage -e 'using Pkg; Pkg.update(); Pkg.instantiate()' - pkgs=$(julia --project=.breakage .breakage/get_jso_users.jl ${{ env.pkg }}) - vs='["latest", "stable"]' - # Check if pkgs is empty, and set it to a JSON array if necessary - if [[ -z "$pkgs" || "$pkgs" == "String[]" ]]; then - echo "No packages found; exiting successfully." - exit 0 - fi - vs='["latest", "stable"]' - matrix=$(jq -cn --argjson deps "$pkgs" --argjson vers "$vs" '{pkg: $deps, pkgversion: $vers}') # don't escape quotes like many posts suggest - echo "matrix=$matrix" >> "$GITHUB_OUTPUT" - - break: - needs: setup_matrix - if: needs.setup_matrix.result == 'success' && needs.setup_matrix.outputs.matrix != '' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{ fromJSON(needs.setup_matrix.outputs.matrix) }} - - steps: - - uses: actions/checkout@v6 - - # Install Julia - - uses: julia-actions/setup-julia@v2 - with: - version: 1 - arch: x64 - - uses: actions/cache@v5 - env: - cache-name: cache-artifacts - with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- - - uses: julia-actions/julia-buildpkg@v1 - - # Breakage test - - name: 'Breakage of ${{ matrix.pkg }}, ${{ matrix.pkgversion }} version' - env: - PKG: ${{ matrix.pkg }} - VERSION: ${{ matrix.pkgversion }} - run: | - set -v - mkdir -p ./breakage - git clone https://github.com/JuliaSmoothOptimizers/$PKG.jl.git - cd $PKG.jl - if [ $VERSION == "stable" ]; then - TAG=$(git tag -l "v*" --sort=-creatordate | head -n1) - if [ -z "$TAG" ]; then - TAG="no_tag" - else - git checkout $TAG - fi - else - TAG=$VERSION - fi - export TAG - julia -e 'using Pkg; - PKG, TAG, VERSION = ENV["PKG"], ENV["TAG"], ENV["VERSION"] - joburl = joinpath(ENV["GITHUB_SERVER_URL"], ENV["GITHUB_REPOSITORY"], "actions/runs", ENV["GITHUB_RUN_ID"]) - open("../breakage/breakage-$PKG-$VERSION", "w") do io - try - TAG == "no_tag" && error("No tag for $VERSION") - pkg"activate ."; - pkg"instantiate"; - pkg"dev ../"; - if TAG == "latest" - global TAG = chomp(read(`git rev-parse --short HEAD`, String)) - end - pkg"build"; - pkg"test"; - - print(io, "[![](https://img.shields.io/badge/$TAG-Pass-green)]($joburl)"); - catch e - @error e; - print(io, "[![](https://img.shields.io/badge/$TAG-Fail-red)]($joburl)"); - end; - end' - - - uses: actions/upload-artifact@v7 - with: - name: breakage-${{ matrix.pkg }}-${{ matrix.pkgversion }} - path: breakage/breakage-* - - upload: - needs: break - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - - uses: actions/download-artifact@v8 - with: - path: breakage - pattern: breakage-* - merge-multiple: true - - - run: ls -R - - run: | - cd breakage - echo "| Package name | latest | stable |" > summary.md - echo "|--|--|--|" >> summary.md - count=0 - for file in breakage-* - do - if [ $count == "0" ]; then - name=$(echo $file | cut -f2 -d-) - echo -n "| $name | " - else - echo -n "| " - fi - cat $file - if [ $count == "0" ]; then - echo -n " " - count=1 - else - echo " |" - count=0 - fi - done >> summary.md - - - name: Display summary in CI logs - run: | - echo "### Breakage Summary" >> $GITHUB_STEP_SUMMARY - cat breakage/summary.md >> $GITHUB_STEP_SUMMARY - - - name: PR comment with file - if: github.event.pull_request.head.repo.fork == false - uses: actions/github-script@main - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - // Import file content from summary.md - const fs = require('fs') - const filePath = 'breakage/summary.md' - const msg = fs.readFileSync(filePath, 'utf8') - - // Get the current PR number from context - const prNumber = context.payload.pull_request.number - - // Fetch existing comments on the PR - const { data: comments } = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: prNumber - }) - - // Find a previous comment by the bot to update - const botComment = comments.find(comment => comment.user.id === 41898282) - - if (botComment) { - // Update the existing comment - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: botComment.id, - body: msg - }) - } else { - // Create a new comment - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: prNumber, - body: msg - }) - } + breakage: + uses: JuliaSmoothOptimizers/.github/.github/workflows/Breakage.yml@main \ No newline at end of file diff --git a/.github/workflows/CommentBreakage.yml b/.github/workflows/CommentBreakage.yml new file mode 100644 index 00000000..a1fbf366 --- /dev/null +++ b/.github/workflows/CommentBreakage.yml @@ -0,0 +1,11 @@ +name: Comment Breakage + +on: + workflow_run: + workflows: ["Breakage"] + types: + - completed + +jobs: + comment_pr: + uses: JuliaSmoothOptimizers/.github/.github/workflows/CommentBreakage.yml@main \ No newline at end of file From d494b32b261970b0759f79298609c7e83a028d2e Mon Sep 17 00:00:00 2001 From: MaxenceGollier Date: Wed, 29 Apr 2026 15:43:32 -0400 Subject: [PATCH 2/3] update formatting --- .github/workflows/Breakage.yml | 4 ++-- .github/workflows/CommentBreakage.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Breakage.yml b/.github/workflows/Breakage.yml index 9a4b1b5b..d73f87ed 100644 --- a/.github/workflows/Breakage.yml +++ b/.github/workflows/Breakage.yml @@ -1,7 +1,7 @@ name: Breakage on: - pull_request: - types: [opened, synchronize, reopened] + pull_request: + types: [opened, synchronize, reopened] jobs: breakage: uses: JuliaSmoothOptimizers/.github/.github/workflows/Breakage.yml@main \ No newline at end of file diff --git a/.github/workflows/CommentBreakage.yml b/.github/workflows/CommentBreakage.yml index a1fbf366..3a063d4d 100644 --- a/.github/workflows/CommentBreakage.yml +++ b/.github/workflows/CommentBreakage.yml @@ -3,7 +3,7 @@ name: Comment Breakage on: workflow_run: workflows: ["Breakage"] - types: + types: - completed jobs: From d76f1b597372f865f4c07eadc88d982f9a74ec4c Mon Sep 17 00:00:00 2001 From: MaxenceGollier Date: Wed, 29 Apr 2026 15:55:17 -0400 Subject: [PATCH 3/3] update formatting --- .github/workflows/Breakage.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/Breakage.yml b/.github/workflows/Breakage.yml index d73f87ed..6c09ef36 100644 --- a/.github/workflows/Breakage.yml +++ b/.github/workflows/Breakage.yml @@ -1,7 +1,9 @@ name: Breakage + on: pull_request: types: [opened, synchronize, reopened] + jobs: breakage: uses: JuliaSmoothOptimizers/.github/.github/workflows/Breakage.yml@main \ No newline at end of file