Skip to content

fix: output extract from docker image #18

fix: output extract from docker image

fix: output extract from docker image #18

Workflow file for this run

name: "Run benchmark"
on:
pull_request_target:
types: [assigned, opened, synchronize, reopened, edited]
push:
branches:
- main
permissions:
contents: write
packages: write
pull-requests: write
issues: write
jobs:
build:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
push: true
tags: ghcr.io/${{ github.repository_owner }}/federated-benchmark:latest
cache-from: type=gha
cache-to: type=gha,mode=max
benchmark:
needs: build
runs-on: ubuntu-latest
# runs-on:
# group: benchmark-runner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
response:
[
big,
medium,
small
]
service:
[
# the theoretical maximum
# source_graphql,
# source_rest_api,
# nginx -> source: the baseline for comparison
# nginx_graphql,
# nginx_rest_api,
# tailcall configurations
tailcall_default,
# tailcall_tweaks,
# tailcall_http_cache,
# tailcall_cache_dir,
# tailcall_dedupe_op,
tailcall_full_conf,
# wundergraph configurations
wundergraph_no_opt,
# wundergraph_dedupe,
wundergraph_default,
# apollo
apollo_router,
# grafbase
grafbase_default,
grafbase_cache
]
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create "output.log" file
run: touch ${{ github.workspace }}/output.log
- id: benchmark
name: Benchmark
uses: addnab/docker-run-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
image: ghcr.io/${{ github.repository_owner }}/federated-benchmark:latest
options: -v ${{ github.workspace }}:/work
run: ./docker_benchmark.sh ${{ matrix.response }} ${{ matrix.service }} >> /work/output.log
- name: Print result
run: cat ${{ github.workspace }}/output.log
- name: Extract Requests Per Second
id: extract_rps
run: |
RPS=$(grep "Requests/sec:" ${{ github.workspace }}/output.log | awk '{print $2}')
echo "rps=${{ matrix.response }} ${{ matrix.service }} ${RPS}" | tee -a "$GITHUB_OUTPUT"
analyze:
needs: benchmark
runs-on: ubuntu-latest
steps:
- id: collect
name: Collect Requests Per Second from all matrix jobs
run: |
DATA=$(
echo "size config rps"
for data in "${{ needs.benchmark.outputs.rps[*] }}"; do
echo "${data}"
done
) echo "data=${DATA}" | tee -a "$GITHUB_OUTPUT"
- id: debug
name: Debug data
run: echo ${{ steps.collect.data }} | tee -a $GITHUB_STEP_SUMMARY