Performance Tests #53
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
name: "Performance Tests" | |
on: | |
workflow_dispatch: | |
env: | |
INFLUX_TOKEN: ${{ secrets.INFLUX_TOKEN }} | |
WT_METRICS_DIR: "${{ github.workspace }}/telegraf/metrics" | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: false | |
jobs: | |
trycp-test: | |
runs-on: [self-hosted, wind-tunnel] | |
strategy: | |
fail-fast: false | |
matrix: | |
# To run a test with TryCP and default configuration, add the scenario name to this array. | |
scenario: [ remote_signals ] | |
# To run a test with TryCP and additional configuration, add the scenario name and `extra-args` as an `include` item. | |
include: | |
- scenario: two_party_countersigning | |
extra-args: "--behaviour initiate:1 --behaviour participate:1" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run - ${{ matrix.scenario }} | |
id: run_test | |
run: | | |
set -x | |
# Start local network services | |
nix develop .#ci -c bash -c "hc-run-local-services --bootstrap-port 4422 --signal-port 4423 &" | |
# Start a TryCP instance | |
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && start_trycp &" | |
RUST_LOG=info TRYCP_RUST_LOG="info" MIN_PEERS=2 nix run .#${{ matrix.scenario }} -- --targets targets.yaml --instances-per-target 2 --duration 120 --no-progress --reporter influx-file ${{ matrix.extra-args }} > >(tee logs/scenario-stdout.log) 2> >(tee logs/scenario-stderr.log >&2) | |
# Stop the TryCP instance | |
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && stop_trycp" | |
# Stop local network services | |
pkill hc-run-local | |
RUN_ID=$(grep -m1 "#RunId" logs/scenario-stdout.log | sed 's/#RunId: \[\(.\+\)\]/\1/') | |
echo "RUN_ID=$RUN_ID" >> "$GITHUB_OUTPUT" | |
echo "# Run ID: $RUN_ID" >> $GITHUB_STEP_SUMMARY | |
- name: Run Telegraf to upload influx metrics | |
run: | | |
if ! nix run .#ci-telegraf | |
then | |
echo "::group::Telegraf errors" | |
status=1 | |
# Print errors as such in GitHub logs. | |
grep "E!" logs/telegraf-stderr.log | xargs -l echo "::error ::" | |
echo "::endgroup::" | |
fi | |
echo "::group::Telegraf warnings" | |
# Print warnings as such in GitHub logs. | |
grep "W!" logs/telegraf-stderr.log | xargs -l echo "::warning ::" | |
echo "::endgroup::" | |
exit ${status-0} | |
- name: Upload logs as artifacts | |
if: success() || failure() | |
id: upload-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "logs_${{ matrix.scenario }}_${{ steps.run_test.outputs.RUN_ID }}" | |
path: | | |
logs/scenario-stdout.log | |
logs/scenario-stderr.log | |
logs/telegraf-stdout.log | |
logs/telegraf-stderr.log | |
logs/${{ steps.run_test.outputs.RUN_ID }}/ | |
- name: Output Path to logs in summary | |
run: | | |
echo "# Logs: [${{ steps.upload-artifact.outputs.artifact-id }}](${{ steps.upload-artifact.outputs.artifact-url }})" >> $GITHUB_STEP_SUMMARY |