Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract benchmark job to a separate workflow, to stop marking build as constantly failed #429

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Benchmark

on:
push:
branches: [ master ]
tags: [ '*' ]
pull_request:
branches: [ master ]
types: [ opened, reopened, labeled, synchronize ]

jobs:
benchmark:

runs-on: benchmarks
concurrency: 'benchmark'
if: >
github.event_name == 'push' ||
(github.event.action == 'labeled' && github.event.label.name == 'benchmark') ||
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'benchmark'))
environment: 'benchmark'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

# coursier parallel fetch is faster than cache download+upload on our custom runner machine
# - uses: coursier/cache-action@v6

- uses: coursier/setup-action@v1.3.0
with:
jvm: 'temurin:1.21.0.1' # TODO LB java version from matrix
apps: sbt

- name: Run Scala 2 benchmarks # TODO: run for Scala 3 too
run: sbt "benchmarks/Jmh/run -rf json -rff $(pwd)/$(git describe --tags --always).json"

- name: Fetch benchmarks metadata
run: curl https://raw.githubusercontent.com/scalalandio/chimney-benchmark-results/main/meta.json -o meta.json

- name: Get nope.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Process current benchmarks results
run: node .github/scripts/process-benchmarks.mjs "$GITHUB_CONTEXT" "$(git describe --tags --always)"
env:
GITHUB_CONTEXT: ${{ toJson(github) }}

- name: Save benchmark results
run: |
SHA=$(cat sha)
mkdir -p ./results/${{ github.event_name }}/$SHA
mv meta.json ./results
mv sha ./results
mv $(git describe --tags --always).json ./results/${{ github.event_name }}/$SHA
echo "$(git describe --tags --always)" > ./results/version
echo "${{ github.event_name }}" > ./results/event

- name: Upload benchmark results
uses: actions/upload-artifact@v2
with:
name: benchmark-results
path: results
55 changes: 0 additions & 55 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,58 +50,3 @@ jobs:
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}

benchmark:
needs: build
runs-on: benchmarks
concurrency: 'benchmark'
if: >
github.event_name == 'push' ||
(github.event.action == 'labeled' && github.event.label.name == 'benchmark') ||
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'benchmark'))
environment: 'benchmark'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

# coursier parallel fetch is faster than cache download+upload on our custom runner machine
# - uses: coursier/cache-action@v6

- uses: coursier/setup-action@v1.3.0
with:
jvm: 'temurin:1.21.0.1' # TODO LB java version from matrix
apps: sbt

- name: Run Scala 2 benchmarks # TODO: run for Scala 3 too
run: sbt "benchmarks/Jmh/run -rf json -rff $(pwd)/$(git describe --tags --always).json"

- name: Fetch benchmarks metadata
run: curl https://raw.githubusercontent.com/scalalandio/chimney-benchmark-results/main/meta.json -o meta.json

- name: Get nope.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Process current benchmarks results
run: node .github/scripts/process-benchmarks.mjs "$GITHUB_CONTEXT" "$(git describe --tags --always)"
env:
GITHUB_CONTEXT: ${{ toJson(github) }}

- name: Save benchmark results
run: |
SHA=$(cat sha)
mkdir -p ./results/${{ github.event_name }}/$SHA
mv meta.json ./results
mv sha ./results
mv $(git describe --tags --always).json ./results/${{ github.event_name }}/$SHA
echo "$(git describe --tags --always)" > ./results/version
echo "${{ github.event_name }}" > ./results/event

- name: Upload benchmark results
uses: actions/upload-artifact@v2
with:
name: benchmark-results
path: results
3 changes: 2 additions & 1 deletion .github/workflows/publish-benchmark-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ name: Publish benchmark results

on:
workflow_run:
workflows: [ 'CI build' ]
workflows: [ 'Benchmark' ]
types: [ completed ]

jobs:
push-to-data-repo:

runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
Expand Down