Skip to content

Commit 8effb70

Browse files
committed
Update Breakage
1 parent ae713da commit 8effb70

File tree

3 files changed

+86
-48
lines changed

3 files changed

+86
-48
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: 65 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,56 @@ 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-
"JuliaSmoothOptimizers/ADNLPModels.jl",
17-
"JuliaSmoothOptimizers/AmplNLReader.jl",
18-
"JuliaSmoothOptimizers/CaNNOLeS.jl",
19-
"JuliaSmoothOptimizers/CUTEst.jl",
20-
"JuliaSmoothOptimizers/DCISolver.jl",
21-
"JuliaSmoothOptimizers/JSOSolvers.jl",
22-
"JuliaSmoothOptimizers/LLSModels.jl",
23-
"JuliaSmoothOptimizers/NLPModelsIpopt.jl",
24-
"JuliaSmoothOptimizers/NLPModelsJuMP.jl",
25-
"JuliaSmoothOptimizers/PDENLPModels.jl",
26-
"JuliaSmoothOptimizers/Percival.jl",
27-
"JuliaSmoothOptimizers/QuadraticModels.jl",
28-
"JuliaSmoothOptimizers/SolverBenchmark.jl",
29-
"JuliaSmoothOptimizers/SolverTools.jl"
30-
]
31-
pkgversion: [latest, stable]
49+
matrix: ${{ fromJSON(needs.setup_matrix.outputs.matrix) }}
3250

3351
steps:
34-
- uses: actions/checkout@v2
52+
- uses: actions/checkout@v4
3553

3654
# Install Julia
37-
- uses: julia-actions/setup-julia@v1
55+
- uses: julia-actions/setup-julia@v2
3856
with:
3957
version: 1
4058
arch: x64
41-
- uses: actions/cache@v1
59+
- uses: actions/cache@v4
4260
env:
4361
cache-name: cache-artifacts
4462
with:
@@ -49,19 +67,16 @@ jobs:
4967
${{ runner.os }}-test-
5068
${{ runner.os }}-
5169
- uses: julia-actions/julia-buildpkg@v1
52-
5370
# Breakage test
54-
- name: 'Breakage of ${{ matrix.pkg }}, ${{ matrix.pkgversion }} version'
71+
- name: "Breakage of ${{ matrix.pkg }}, ${{ matrix.pkgversion }} version"
5572
env:
56-
URL: ${{ matrix.pkg }}
73+
PKG: ${{ matrix.pkg }}
5774
VERSION: ${{ matrix.pkgversion }}
5875
run: |
5976
set -v
60-
mkdir -p ./pr
61-
echo "${{ github.event.number }}" > ./pr/NR
62-
git clone https://github.com/$URL
63-
export PKG=$(echo $URL | cut -f2 -d/)
64-
cd $PKG
77+
mkdir -p ./breakage
78+
git clone https://github.com/JuliaSmoothOptimizers/$PKG.jl.git
79+
cd $PKG.jl
6580
if [ $VERSION == "stable" ]; then
6681
TAG=$(git tag -l "v*" --sort=-creatordate | head -n1)
6782
if [ -z "$TAG" ]; then
@@ -76,12 +91,15 @@ jobs:
7691
julia -e 'using Pkg;
7792
PKG, TAG, VERSION = ENV["PKG"], ENV["TAG"], ENV["VERSION"]
7893
joburl = joinpath(ENV["GITHUB_SERVER_URL"], ENV["GITHUB_REPOSITORY"], "actions/runs", ENV["GITHUB_RUN_ID"])
79-
open("../pr/$PKG-$VERSION", "w") do io
94+
open("../breakage/breakage-$PKG-$VERSION", "w") do io
8095
try
8196
TAG == "no_tag" && error("Not tag for $VERSION")
8297
pkg"activate .";
8398
pkg"instantiate";
8499
pkg"dev ../";
100+
if TAG == "latest"
101+
global TAG = chomp(read(`git rev-parse --short HEAD`, String))
102+
end
85103
pkg"build";
86104
pkg"test";
87105
@@ -94,32 +112,31 @@ jobs:
94112
95113
- uses: actions/upload-artifact@v4
96114
with:
97-
name: pr
98-
path: pr/
115+
name: breakage-${{ matrix.pkg }}-${{ matrix.pkgversion }}
116+
path: breakage/breakage-*
99117

100118
upload:
101119
needs: break
102120
runs-on: ubuntu-latest
103121
steps:
104-
- uses: actions/checkout@v2
122+
- uses: actions/checkout@v4
105123

106-
- uses: actions/download-artifact@v3
124+
- uses: actions/download-artifact@v4
107125
with:
108-
name: pr
109-
path: pr/
126+
path: breakage
127+
pattern: breakage-*
128+
merge-multiple: true
110129

111-
- run: ls
130+
- run: ls -R
112131
- run: |
113-
cd pr
114-
echo "| Package name | latest | stable |" > MSG
115-
echo "|--|--|--|" >> MSG
132+
cd breakage
133+
echo "| Package name | latest | stable |" > summary.md
134+
echo "|--|--|--|" >> summary.md
116135
count=0
117-
for file in *
136+
for file in breakage-*
118137
do
119-
[ "$file" == "NR" ] && continue
120-
[ "$file" == "MSG" ] && continue
121138
if [ $count == "0" ]; then
122-
name=$(echo $file | cut -f1 -d-)
139+
name=$(echo $file | cut -f2 -d-)
123140
echo -n "| $name | "
124141
else
125142
echo -n "| "
@@ -132,9 +149,9 @@ jobs:
132149
echo " |"
133150
count=0
134151
fi
135-
done >> MSG
152+
done >> summary.md
136153
137-
- uses: actions/upload-artifact@v4
154+
- name: PR comment with file
155+
uses: thollander/actions-comment-pull-request@v2
138156
with:
139-
name: pr
140-
path: pr/
157+
filePath: breakage/summary.md

0 commit comments

Comments
 (0)