Skip to content

Commit

Permalink
breakage: compute dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
dpo committed Oct 16, 2024
1 parent 1904384 commit 2d6e073
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .breakage/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26"
PkgDeps = "839e9fc8-855b-5b3c-a3b7-2833d3dd1f59"
18 changes: 18 additions & 0 deletions .breakage/get_jso_users.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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)
55 changes: 38 additions & 17 deletions .github/workflows/Breakage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,46 @@ on:
pull_request:

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@v4
- 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"]'
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
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pkg: [
"CaNNOLeS.jl",
"DCISolver.jl",
"FletcherPenaltySolver.jl",
"JSOSolvers.jl",
"Krylov.jl",
"NLPModels.jl",
"NLPModelsModifiers.jl",
"Percival.jl",
"PROPACK.jl",
"QuadraticModels.jl",
"SolverTools.jl"
]
pkgversion: [latest, stable]
matrix: ${{ fromJSON(needs.setup_matrix.outputs.matrix) }}

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -55,8 +76,8 @@ jobs:
run: |
set -v
mkdir -p ./breakage
git clone https://github.com/JuliaSmoothOptimizers/$PKG
cd $PKG
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
Expand Down

0 comments on commit 2d6e073

Please sign in to comment.