Merge remote-tracking branch 'origin/main' into plc/issues/NDAT-950 #930
Workflow file for this run
This file contains 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
on: [push] | |
name: Postgres NDC component benchmarks | |
permissions: | |
contents: write | |
deployments: write | |
jobs: | |
benchmark: | |
name: Benchmark | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Install Nix ❄ | |
uses: cachix/install-nix-action@v23 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up the Nix Cache 🔌 | |
uses: cachix/cachix-action@v12 | |
with: | |
name: hasura-v3-dev | |
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
- name: Build the Docker image 🔨 | |
run: | | |
docker load < $(nix build --no-link --print-out-paths '.#docker') | |
- name: Start dependencies ▶️ | |
run: | | |
cd benchmarks/component | |
docker compose up --detach --wait postgres grafana | |
- name: Generate the deployment configuration 🚧 | |
run: | | |
set -e -u -o pipefail | |
cd benchmarks/component | |
mkdir -p generated | |
docker compose up --detach --wait agent-configuration | |
CONFIGURATION_SERVER_PORT="$(docker compose port agent-configuration 9100 | sed 's/.\+://')" | |
CONFIGURATION_SERVER="localhost:${CONFIGURATION_SERVER_PORT}" | |
../../scripts/new-configuration.sh "$CONFIGURATION_SERVER" 'postgresql://postgres:password@postgres' \ | |
| tee ./generated/deployment.json | |
docker compose down agent-configuration | |
- name: Run benchmarks 🏃 | |
run: | | |
cd benchmarks/component | |
for benchmark in $(ls benchmarks); do | |
echo "Starting agent..." | |
docker compose up --wait agent | |
echo "Running ${benchmark}..." | |
docker compose run --rm benchmark run "/benchmarks/$benchmark" | |
echo "Saving metrics for ${benchmark}..." | |
./metrics.sh localhost:8100 ${benchmark} | |
echo "Stopping agent..." | |
docker compose down agent | |
done | |
- name: Extract summaries ⛏️ | |
run: | | |
./benchmarks/component/summarize.sh | tee benchmark-results.json | |
# We run these benchmarks on every push so we can easily see the results. | |
# However, we only store the results on `main`. | |
- name: Store benchmark result ⬆️ | |
if: github.ref == 'refs/heads/main' | |
uses: benchmark-action/github-action-benchmark@v1 | |
with: | |
name: Component benchmarks | |
tool: customSmallerIsBetter | |
output-file-path: benchmark-results.json | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
auto-push: true | |
alert-threshold: 200% | |
comment-on-alert: true | |
# scream into Slack if something goes wrong | |
- name: Report Status | |
if: always() && github.ref == 'refs/heads/main' | |
uses: ravsamhq/notify-slack-action@v2 | |
with: | |
status: ${{ job.status }} | |
notify_when: failure | |
notification_title: "😧 Error on <{repo_url}|{repo}>" | |
message_format: "🐴 *{workflow}* {status_message} for <{repo_url}|{repo}>" | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.BROKEN_BUILD_SLACK_WEBHOOK_URL }} |