Skip to content

Commit 2d6e073

Browse files
committed
breakage: compute dependencies
1 parent 1904384 commit 2d6e073

File tree

3 files changed

+59
-17
lines changed

3 files changed

+59
-17
lines changed

.breakage/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[deps]
2+
GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26"
3+
PkgDeps = "839e9fc8-855b-5b3c-a3b7-2833d3dd1f59"

.breakage/get_jso_users.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import GitHub, PkgDeps # both export users()
2+
3+
length(ARGS) >= 1 || error("specify at least one JSO package as argument")
4+
5+
jso_repos, _ = GitHub.repos("JuliaSmoothOptimizers")
6+
jso_names = [splitext(x.name)[1] for x jso_repos]
7+
8+
name = splitext(ARGS[1])[1]
9+
name jso_names || error("argument should be one of ", jso_names)
10+
11+
dependents = String[]
12+
try
13+
global dependents = filter(x -> x jso_names, PkgDeps.users(name))
14+
catch e
15+
# package not registered; don't insert into dependents
16+
end
17+
18+
println(dependents)

.github/workflows/Breakage.yml

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,46 @@ on:
77
pull_request:
88

99
jobs:
10+
# Build dynamically the matrix on which the "break" job will run.
11+
# The matrix contains the packages that depend on ${{ env.pkg }}.
12+
# Job "setup_matrix" outputs variable "matrix", which is in turn
13+
# the output of the "getmatrix" step.
14+
# The contents of "matrix" is a JSON description of a matrix used
15+
# in the next step. It has the form
16+
# {
17+
# "pkg": [
18+
# "PROPACK",
19+
# "LLSModels",
20+
# "FletcherPenaltySolver"
21+
# ]
22+
# }
23+
setup_matrix:
24+
runs-on: ubuntu-latest
25+
outputs:
26+
matrix: ${{ steps.getmatrix.outputs.matrix }}
27+
env:
28+
pkg: ${{ github.event.repository.name }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: julia-actions/setup-julia@v2
32+
with:
33+
version: 1
34+
arch: x64
35+
- id: getmatrix
36+
run: |
37+
julia -e 'using Pkg; Pkg.Registry.add(RegistrySpec(url = "https://github.com/JuliaRegistries/General.git"))'
38+
julia --project=.breakage -e 'using Pkg; Pkg.update(); Pkg.instantiate()'
39+
pkgs=$(julia --project=.breakage .breakage/get_jso_users.jl ${{ env.pkg }})
40+
vs='["latest", "stable"]'
41+
matrix=$(jq -cn --argjson deps "$pkgs" --argjson vers "$vs" '{pkg: $deps, pkgversion: $vers}') # don't escape quotes like many posts suggest
42+
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
43+
1044
break:
45+
needs: setup_matrix
1146
runs-on: ubuntu-latest
1247
strategy:
1348
fail-fast: false
14-
matrix:
15-
pkg: [
16-
"CaNNOLeS.jl",
17-
"DCISolver.jl",
18-
"FletcherPenaltySolver.jl",
19-
"JSOSolvers.jl",
20-
"Krylov.jl",
21-
"NLPModels.jl",
22-
"NLPModelsModifiers.jl",
23-
"Percival.jl",
24-
"PROPACK.jl",
25-
"QuadraticModels.jl",
26-
"SolverTools.jl"
27-
]
28-
pkgversion: [latest, stable]
49+
matrix: ${{ fromJSON(needs.setup_matrix.outputs.matrix) }}
2950

3051
steps:
3152
- uses: actions/checkout@v4
@@ -55,8 +76,8 @@ jobs:
5576
run: |
5677
set -v
5778
mkdir -p ./breakage
58-
git clone https://github.com/JuliaSmoothOptimizers/$PKG
59-
cd $PKG
79+
git clone https://github.com/JuliaSmoothOptimizers/$PKG.jl.git
80+
cd $PKG.jl
6081
if [ $VERSION == "stable" ]; then
6182
TAG=$(git tag -l "v*" --sort=-creatordate | head -n1)
6283
if [ -z "$TAG" ]; then

0 commit comments

Comments
 (0)