Skip to content

Commit

Permalink
Trivial change, test PR (#347)
Browse files Browse the repository at this point in the history
* Trivial change, test PR

* Add PR write permission

* Test full permissions

* Granular permissions

* try write-all

* try label event

* labeled in pull_request

* Store results as artifact and trigger a consecutive workflow_run

* Workflow chain almost complete (WIP)

* correct .benchmarkci path

* Add benchx support branch

* Just try pull_request_target instead

* Remove target

* Get rid of s to get the chain going

---------

Co-authored-by: Guillaume Dalle <[email protected]>
  • Loading branch information
filchristou and gdalle authored Mar 4, 2024
1 parent 3e9bac9 commit 9004fc1
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 16 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/postbench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: PostBenchmarks
on:
workflow_run:
workflows: [RunUploadBenchmarks]
types: [completed]
branches: [master, benchx]
jobs:
on-success:
runs-on: ubuntu-latest
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- run: echo 'The triggering workflow passed'
- name: 'Download artifact'
uses: actions/github-script@v6
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "BenchmarkResults"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/BenchmarkResults.zip`, Buffer.from(download.data));
- name: 'Unzip artifact'
run: unzip BenchmarkResults.zip -d .benchmarkci/
- name: 'Post results test 1'
run: julia -e 'using BenchmarkCI; BenchmarkCI.postjudge()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Comment on PR test 2'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let fs = require('fs');
let issue_number = Number(fs.readFileSync('./pr_number'));
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'Thank you for the PR!'
});
- name: 'Comment on PR test 3'
run: gh pr comment "$NUMBER" --body "$BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.pull_request.number }}
BODY: >
This pr comment is testing.
**This should be bold**
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
name: performance tracking
name: RunUploadBenchmarks
env:
JULIA_NUM_THREADS: 2
on:
pull_request:
# types: [labeled]
branches:
- master
- benchx
- master
- benchx
push:
branches:
- master
- benchx
- master
- benchx
tags: '*'
jobs:
benchmark:
# if: ${{ github.event.label.name == 'to-benchmark' }}
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.allow_failure }}
permissions: write-all
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -52,14 +55,22 @@ jobs:
run: julia -e "
using BenchmarkCI, PkgBenchmark;
jd=BenchmarkCI.judge(baseline=\"origin/${GITHUB_BASE_REF}\");
writeresults(\"targetbenchout.json\", jd.target_results);
writeresults(\"baselinebenchout.json\", jd.baseline_results);
"
- name: Post results if pull request
if: github.event_name == 'pull_request'
run: julia -e 'using BenchmarkCI; BenchmarkCI.postjudge()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Post results if pull request
# if: github.event_name == 'pull_request'
# run: julia -e 'using BenchmarkCI; BenchmarkCI.postjudge()'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Add comment
# if: github.event_name == 'pull_request'
# run: gh pr comment "$NUMBER" --body "$BODY"
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GH_REPO: ${{ github.repository }}
# NUMBER: ${{ github.event.pull_request.number }}
# BODY: >
# This pr comment is testing.
# **This should be bold**
- name: Run benchmark if push/merge
if: github.event_name == 'push'
run: julia --project=benchmark -e "
Expand All @@ -71,8 +82,13 @@ jobs:
br_median = BenchmarkResults(br.name, br.commit, median(br.benchmarkgroup), br.date, br.julia_commit, br.vinfo, br.benchmarkconfig);
writeresults(\"medianbenchout.json\", br_median);
"
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > .benchmarkci/pr_number
- uses: actions/upload-artifact@v3
with:
name: Store benchmark result
path: ./*benchout.json
name: BenchmarkResults
path: .benchmarkci/
3 changes: 1 addition & 2 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using BenchmarkTools
using Graphs
using BenchmarkTools, Graphs

const BENCHDIR = dirname(@__FILE__)

Expand Down

0 comments on commit 9004fc1

Please sign in to comment.