Skip to content
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
61 changes: 52 additions & 9 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Benchmarks
permissions:
contents: write
packages: read
pull-requests: write

on:
workflow_dispatch:
Expand Down Expand Up @@ -47,10 +48,27 @@ jobs:
permissions:
contents: write
packages: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Verify required tools
run: |
echo "Checking required tools for PR creation..."
if ! command -v git &> /dev/null; then
echo "❌ git is not installed"
exit 1
fi
echo "✓ git: $(git --version)"

if ! command -v gh &> /dev/null; then
echo "❌ gh (GitHub CLI) is not installed"
exit 1
fi
echo "✓ gh: $(gh --version | head -1)"
echo "All required tools are available"

- name: Log in to Container Registry
uses: docker/login-action@v3
with:
Expand Down Expand Up @@ -83,16 +101,41 @@ jobs:
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.check-image.outputs.image-tag }} \
cargo test --release --test bdd -- --tags @bench

- name: Commit benchmark results
- name: Create Pull Request with benchmark results
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
# Save benchmarks.md before reset
cp documentation/docs/benchmarks.md /tmp/benchmarks.md.tmp
git fetch origin ${{ github.ref_name }}
git reset --hard origin/${{ github.ref_name }}
# Restore benchmarks.md after reset
cp /tmp/benchmarks.md.tmp documentation/docs/benchmarks.md

# Save the updated benchmarks.md BEFORE switching branches
# (docker run modifies the file in the workspace)
cp documentation/docs/benchmarks.md /tmp/benchmarks.md

# Create a unique branch name with timestamp
BRANCH_NAME="benchmark-results-$(date +%Y%m%d-%H%M%S)"

# Fetch latest master and create new branch from it
git fetch origin master
git checkout -b "$BRANCH_NAME" origin/master

# Copy the saved benchmarks.md back
cp /tmp/benchmarks.md documentation/docs/benchmarks.md

# Check if there are any changes to commit
git add documentation/docs/benchmarks.md
git diff --staged --quiet || git commit -m "Update benchmark results [skip ci]"
git push --force-with-lease
if git diff --staged --quiet; then
echo "No changes to benchmark results, skipping PR creation"
exit 0
fi

# Commit and push
git commit -m "Update benchmark results [skip ci]"
git push origin "$BRANCH_NAME"

# Create Pull Request to master
gh pr create \
--title "Update benchmark results" \
--body "Automated benchmark results update from CI workflow. This PR updates the benchmark comparison table in documentation/docs/benchmarks.md." \
--base "master" \
--head "$BRANCH_NAME"
8 changes: 4 additions & 4 deletions .github/workflows/build-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ jobs:
- name: Build binaries in release mode
run: JEMALLOC_SYS_WITH_MALLOC_CONF="dirty_decay_ms:30000,muzzy_decay_ms:30000,background_thread:true,metadata_thp:auto" cargo build --release
- name: Prepare output dir
run: mkdir -p ./build_package/usr/bin && install ./target/release/pg_doorman ./build_package/usr/bin && mkdir -p ./out/
run: mkdir -p ./build_package/usr/bin && install ./target/release/pg_doorman ./build_package/usr/bin && install ./target/release/patroni_proxy ./build_package/usr/bin && mkdir -p ./out/
- name: Check versions
run: ./build_package/usr/bin/pg_doorman --version && cat /etc/debian_version
run: ./build_package/usr/bin/pg_doorman --version && ./build_package/usr/bin/patroni_proxy --version && cat /etc/debian_version
- name: Fix package name
run: |
export PACKAGE_NAME=pg_doorman-${{ matrix.image }}.deb &&
Expand Down Expand Up @@ -122,9 +122,9 @@ jobs:
- name: Build binaries in release mode
run: JEMALLOC_SYS_WITH_MALLOC_CONF="dirty_decay_ms:30000,muzzy_decay_ms:30000,background_thread:true,metadata_thp:auto" cargo build --release
- name: Prepare output dir
run: mkdir -p ./build_package/usr/bin && install ./target/release/pg_doorman ./build_package/usr/bin && mkdir -p ./out/
run: mkdir -p ./build_package/usr/bin && install ./target/release/pg_doorman ./build_package/usr/bin && install ./target/release/patroni_proxy ./build_package/usr/bin && mkdir -p ./out/
- name: Check versions
run: ./build_package/usr/bin/pg_doorman --version && cat /etc/system-release
run: ./build_package/usr/bin/pg_doorman --version && ./build_package/usr/bin/patroni_proxy --version && cat /etc/system-release
- name: Fix package name
run: |
export PACKAGE_NAME=pg_doorman-${{ matrix.image }}.rpm &&
Expand Down
Loading
Loading