Breakage: use upload-artifact v4 #312
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ref: https://securitylab.github.com/research/github-actions-preventing-pwn-requests | |
name: Breakage | |
# read-only repo token | |
# no access to secrets | |
on: | |
pull_request: | |
jobs: | |
break: | |
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] | |
steps: | |
- uses: actions/checkout@v2 | |
# Install Julia | |
- uses: julia-actions/setup-julia@v1 | |
with: | |
version: 1 | |
arch: x64 | |
- uses: actions/cache@v1 | |
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 | |
# echo "${{ github.event.number }}" > ./breakage-$PKG-$VERSION/NR | |
git clone https://github.com/JuliaSmoothOptimizers/$PKG | |
cd $PKG | |
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("Not 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' | |
# - name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v3 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: breakage-${{ matrix.pkg }}-${{ matrix.pkgversion }} | |
path: breakage/breakage-* | |
upload: | |
needs: break | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v4 | |
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 * | |
do | |
[ "$file" == "MSG" ] && continue | |
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: PR comment with file | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
filePath: breakage/summary.md | |
# - uses: actions/upload-artifact@v4 | |
# with: | |
# name: pr | |
# path: pr/ |