chore: update cui-java-parent from 1.6.1 to 1.6.2 #155
Workflow file for this run
This file contains hidden or 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
| name: Performance Benchmark | |
| on: | |
| pull_request: | |
| branches: [ "main" ] | |
| types: [ closed ] | |
| push: | |
| tags: [ "*" ] | |
| workflow_dispatch: | |
| # Declare default permissions as read only (principle of least privilege) | |
| permissions: | |
| contents: read | |
| # Serialize all benchmark runs behind a single static group so that closely-merged PRs | |
| # queue instead of racing each other's git push to cuioss.github.io. The concurrency group | |
| # covers this repository's own runs; the deploy step's bounded fetch-rebase-retry loop | |
| # absorbs races against deploys pushed by sibling repositories. | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: false # Don't cancel in-progress runs as benchmarks are expensive | |
| jobs: | |
| benchmark: | |
| name: Run JMH Benchmarks | |
| runs-on: ubuntu-latest | |
| # Only run on merged PRs, not just closed ones | |
| if: github.event_name != 'pull_request' || github.event.pull_request.merged == true | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0 | |
| with: | |
| egress-policy: audit | |
| - name: Create GitHub App token for deployment | |
| id: app-token | |
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | |
| with: | |
| app-id: ${{ secrets.RELEASE_APP_ID }} | |
| private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} | |
| repositories: ${{ github.event.repository.name }},cuioss.github.io | |
| owner: cuioss | |
| - name: Checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Build all modules | |
| run: | | |
| ./mvnw --no-transfer-progress clean install -DskipTests | |
| - name: Fetch Previous History | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: cuioss/cuioss.github.io | |
| ref: main | |
| path: previous-pages | |
| sparse-checkout: | | |
| cui-http/benchmarks/micro/history | |
| continue-on-error: true | |
| - name: Prepare Historical Data for Benchmarks | |
| run: | | |
| python3 cui-http-benchmarking/scripts/benchmark-pages.py prepare-history \ | |
| --previous-pages-dir previous-pages/cui-http/benchmarks \ | |
| --output-dir "${GITHUB_WORKSPACE}/benchmark-history" | |
| - name: Run Micro Benchmarks | |
| run: | | |
| ./mvnw --no-transfer-progress clean verify -pl cui-http-benchmarking -Pbenchmark \ | |
| -Dbenchmark.history.dir="${GITHUB_WORKSPACE}/benchmark-history/micro" | |
| echo "Micro benchmark artifacts generated:" | |
| ls -la cui-http-benchmarking/target/benchmark-results/ | |
| - name: Assemble benchmark artifacts for deployment | |
| run: | | |
| python3 cui-http-benchmarking/scripts/benchmark-pages.py assemble \ | |
| --micro-results cui-http-benchmarking/target/benchmark-results/gh-pages-ready \ | |
| --previous-pages-dir previous-pages/cui-http/benchmarks \ | |
| --output-dir gh-pages \ | |
| --commit-sha "${{ github.sha }}" | |
| - name: Upload benchmark results | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: benchmark-results | |
| path: gh-pages/ | |
| retention-days: 90 | |
| - name: Checkout cuioss.github.io for deployment | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: cuioss/cuioss.github.io | |
| path: _pages-deploy | |
| sparse-checkout: cui-http/benchmarks | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Deploy to cuioss.github.io | |
| run: | | |
| TARGET_DIR="_pages-deploy/cui-http/benchmarks" | |
| rm -rf "$TARGET_DIR" | |
| mkdir -p "$TARGET_DIR" | |
| cp -r gh-pages/* "$TARGET_DIR/" | |
| cd _pages-deploy | |
| git config user.name "cuioss-release-bot[bot]" | |
| git config user.email "cuioss-release-bot[bot]@users.noreply.github.com" | |
| git add . | |
| git diff --staged --quiet || git commit -m "Deploy benchmark results from ${{ github.sha }}" | |
| # cuioss.github.io also receives deploys from sibling repositories, which this | |
| # workflow's concurrency group cannot serialize, so the push can lose a race. | |
| # Retry a bounded number of times, rebasing onto the new remote tip between | |
| # attempts. A fetch or rebase failure is not a race — propagate it immediately | |
| # rather than burning the remaining attempts on it. | |
| max_attempts=5 | |
| attempt=1 | |
| while [ "$attempt" -le "$max_attempts" ]; do | |
| if git push; then | |
| echo "Deploy push succeeded on attempt ${attempt}/${max_attempts}" | |
| exit 0 | |
| fi | |
| echo "Deploy push rejected on attempt ${attempt}/${max_attempts}; rebasing onto origin/main" | |
| git fetch origin main | |
| git rebase origin/main | |
| attempt=$((attempt + 1)) | |
| done | |
| echo "Deploy push failed after ${max_attempts} attempts" >&2 | |
| exit 1 |