summaryrefslogtreecommitdiffstats
path: root/.github/workflows/benchmark.yml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 05:03:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 05:03:04 +0000
commitb88736462df2c86a83f01dcc260b5463205819d2 (patch)
treeb1a9a5a5392a52ec4e5f60fb4b45083cf7fd65b0 /.github/workflows/benchmark.yml
parentAdding upstream version 1.7.2+ds. (diff)
downloadlibgit2-b88736462df2c86a83f01dcc260b5463205819d2.tar.xz
libgit2-b88736462df2c86a83f01dcc260b5463205819d2.zip
Adding upstream version 1.8.1+ds.upstream/1.8.1+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '.github/workflows/benchmark.yml')
-rw-r--r--.github/workflows/benchmark.yml74
1 files changed, 66 insertions, 8 deletions
diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml
index bf21674..6ee492a 100644
--- a/.github/workflows/benchmark.yml
+++ b/.github/workflows/benchmark.yml
@@ -6,10 +6,14 @@ on:
schedule:
- cron: '15 4 * * *'
+permissions:
+ contents: read
+
jobs:
- # Run our nightly builds. We build a matrix with the various build
- # targets and their details. Then we build either in a docker container
- # (Linux) or on the actual hosts (macOS, Windows).
+ # Run our benchmarks. We build a matrix with the various build
+ # targets and their details. Unlike our CI builds, we run these
+ # directly on the VM instead of in containers since we do not
+ # need the breadth of platform diversity.
build:
# Only run scheduled workflows on the main repository; prevents people
# from using build minutes on their forks.
@@ -27,7 +31,7 @@ jobs:
os: ubuntu-latest
setup-script: ubuntu
- name: "macOS"
- os: macos-11
+ os: macos-12
env:
CC: clang
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_GSSAPI=ON -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
@@ -45,12 +49,12 @@ jobs:
id: windows
setup-script: win32
fail-fast: false
- name: "Build ${{ matrix.platform.name }}"
+ name: "Benchmark ${{ matrix.platform.name }}"
env: ${{ matrix.platform.env }}
runs-on: ${{ matrix.platform.os }}
steps:
- name: Check out repository
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
path: source
fetch-depth: 0
@@ -72,11 +76,65 @@ jobs:
fi
mkdir benchmark && cd benchmark
- ../source/tests/benchmarks/benchmark.sh --baseline-cli "git" --cli "${GIT2_CLI}" --json benchmarks.json --zip benchmarks.zip
+ ../source/tests/benchmarks/benchmark.sh --baseline-cli "git" --cli "${GIT2_CLI}" --name libgit2 --json benchmarks.json --zip benchmarks.zip
shell: bash
- name: Upload results
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v4
with:
name: benchmark-${{ matrix.platform.id }}
path: benchmark
if: always()
+
+ # Publish the results
+ publish:
+ name: Publish results
+ needs: [ build ]
+ if: ${{ always() && github.repository == 'libgit2/libgit2' }}
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out benchmark repository
+ uses: actions/checkout@v4
+ with:
+ repository: libgit2/benchmarks
+ path: site
+ fetch-depth: 0
+ ssh-key: ${{ secrets.BENCHMARKS_PUBLISH_KEY }}
+ - name: Download test results
+ uses: actions/download-artifact@v4
+ - name: Publish API
+ run: |
+ # Move today's benchmark run into the right place
+ for platform in linux macos windows; do
+ TIMESTAMP=$(jq .time.start < "benchmark-${platform}/benchmarks.json")
+ TIMESTAMP_LEN=$(echo -n ${TIMESTAMP} | wc -c | xargs)
+ DENOMINATOR=1
+ if [ "${TIMESTAMP_LEN}" = "19" ]; then
+ DENOMINATOR="1000000000"
+ elif [ "${TIMESTAMP_LEN}" = "13" ]; then
+ DENOMINATOR="1000"
+ else
+ echo "unknown timestamp"
+ exit 1
+ fi
+
+ if [[ "$(uname -s)" == "Darwin" ]]; then
+ DATE=$(date -R -r $(("${TIMESTAMP}/${DENOMINATOR}")) +"%Y-%m-%d")
+ else
+ DATE=$(date -d @$(("${TIMESTAMP}/${DENOMINATOR}")) +"%Y-%m-%d")
+ fi
+
+ mkdir -p "site/public/api/runs/${DATE}"
+ cp "benchmark-${platform}/benchmarks.json" "site/public/api/runs/${DATE}/${platform}.json"
+ done
+
+ (cd site && node scripts/aggregate.js)
+
+ (
+ cd site &&
+ git config user.name 'Benchmark Site Generation' &&
+ git config user.email 'libgit2@users.noreply.github.com' &&
+ git add . &&
+ git commit --allow-empty -m"benchmark update ${DATE}" &&
+ git push origin main
+ )
+ shell: bash