Skip to content

Commit ef5bcd2

Browse files
committed
Add breakage workflow
1 parent 309a61a commit ef5bcd2

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

.github/workflows/Breakage.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Breakage
2+
# Based on: https://github.com/JuliaSmoothOptimizers/LinearOperators.jl/blob/main/.github/workflows/Breakage.yml
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
break:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
pkg: [
15+
"JuliaImageRecon/RegularizedLeastSquares.jl",
16+
"MagneticResonanceImaging/MRIReco.jl"
17+
]
18+
pkgversion: [latest, stable]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
# Install Julia
24+
- uses: julia-actions/setup-julia@v2
25+
with:
26+
version: 1
27+
arch: x64
28+
- uses: actions/cache@v1
29+
env:
30+
cache-name: cache-artifacts
31+
with:
32+
path: ~/.julia/artifacts
33+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
34+
restore-keys: |
35+
${{ runner.os }}-test-${{ env.cache-name }}-
36+
${{ runner.os }}-test-
37+
${{ runner.os }}-
38+
- uses: julia-actions/julia-buildpkg@v1
39+
40+
# Breakage test
41+
- name: 'Breakage of ${{ matrix.pkg }}, ${{ matrix.pkgversion }} version'
42+
env:
43+
URL: ${{ matrix.pkg }}
44+
VERSION: ${{ matrix.pkgversion }}
45+
run: |
46+
set -v
47+
mkdir -p ./pr
48+
echo "${{ github.event.number }}" > ./pr/NR
49+
git clone https://github.com/$URL
50+
export PKG=$(echo $URL | cut -f2 -d/)
51+
cd $PKG
52+
if [ $VERSION == "stable" ]; then
53+
TAG=$(git tag -l "v*" --sort=-creatordate | head -n1)
54+
if [ -z "$TAG" ]; then
55+
TAG="no_tag"
56+
else
57+
git checkout $TAG
58+
fi
59+
else
60+
TAG=$VERSION
61+
fi
62+
export TAG
63+
julia -e 'using Pkg;
64+
PKG, TAG, VERSION = ENV["PKG"], ENV["TAG"], ENV["VERSION"]
65+
joburl = joinpath(ENV["GITHUB_SERVER_URL"], ENV["GITHUB_REPOSITORY"], "actions/runs", ENV["GITHUB_RUN_ID"])
66+
open("../pr/$PKG-$VERSION", "w") do io
67+
try
68+
TAG == "no_tag" && error("Not tag for $VERSION")
69+
pkg"activate .";
70+
pkg"instantiate";
71+
pkg"dev ../";
72+
if TAG == "latest"
73+
global TAG = chomp(read(`git rev-parse --short HEAD`, String))
74+
end
75+
pkg"build";
76+
pkg"test";
77+
78+
print(io, "[![](https://img.shields.io/badge/$TAG-Pass-green)]($joburl)");
79+
catch e
80+
@error e;
81+
print(io, "[![](https://img.shields.io/badge/$TAG-Fail-red)]($joburl)");
82+
end;
83+
end'
84+
85+
- uses: actions/upload-artifact@v2
86+
with:
87+
name: pr
88+
path: pr/

0 commit comments

Comments
 (0)