-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(perf): Allow for test filtering + Github composite action (#280)
* feat(perf): Allow for test filtering + Github composite action * chore: updated workflow variables * ci: ensure working directory is set + env variables for terraform * chore: default the test filter to all implementations
- Loading branch information
Showing
4 changed files
with
174 additions
and
88 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
name: "libp2p ping interop test" | ||
description: "Run the libp2p ping interoperability test suite" | ||
inputs: | ||
test-filter: | ||
description: "Filter which tests to run, only these implementations will be run" | ||
required: false | ||
default: "all" | ||
s3-access-key-id: | ||
description: "S3 Access key id for the terraform infrastructure" | ||
required: true | ||
default: "" | ||
s3-secret-access-key: | ||
description: "S3 secret key id for the terraform infrastructure" | ||
required: true | ||
default: "" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- id: ssh | ||
shell: bash | ||
name: Generate SSH key | ||
working-directory: perf | ||
run: | | ||
make ssh-keygen | ||
echo "key<<EOF" >> $GITHUB_OUTPUT | ||
while read -r line; do | ||
echo "::add-mask::$line" | ||
echo "$line" >> $GITHUB_OUTPUT | ||
done < terraform/modules/short_lived/files/perf | ||
echo "EOF" >> $GITHUB_OUTPUT | ||
- name: Configure SSH | ||
uses: webfactory/ssh-agent@d4b9b8ff72958532804b70bbe600ad43b36d5f2e # v0.8.0 | ||
with: | ||
ssh-private-key: ${{ steps.ssh.outputs.key }} | ||
|
||
- name: Configure git | ||
shell: bash | ||
run: | | ||
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com>" | ||
git config --global user.name "${GITHUB_ACTOR}" | ||
- name: Configure terraform | ||
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3 | ||
|
||
- name: Init terraform | ||
id: init | ||
shell: bash | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ inputs.s3-access-key-id }} | ||
AWS_SECRET_ACCESS_KEY: ${{ inputs.s3-secret-access-key }} | ||
TF_IN_AUTOMATION: "1" | ||
TF_INPUT: "0" | ||
run: terraform init | ||
working-directory: perf/terraform/configs/local | ||
|
||
- name: Apply terraform | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ inputs.s3-access-key-id }} | ||
AWS_SECRET_ACCESS_KEY: ${{ inputs.s3-secret-access-key }} | ||
TF_IN_AUTOMATION: "1" | ||
TF_INPUT: "0" | ||
shell: bash | ||
run: terraform apply -auto-approve | ||
working-directory: perf/terraform/configs/local | ||
|
||
- id: server | ||
name: Retrieve server's IP | ||
shell: bash | ||
run: terraform output -raw server_ip | ||
working-directory: perf/terraform/configs/local | ||
|
||
- id: client | ||
name: Retrieve client's IP | ||
shell: bash | ||
run: terraform output -raw client_ip | ||
working-directory: perf/terraform/configs/local | ||
|
||
- name: Download dependencies | ||
shell: bash | ||
run: npm ci | ||
working-directory: perf/runner | ||
|
||
- name: Run tests | ||
shell: bash | ||
env: | ||
SERVER_IP: ${{ steps.server.outputs.stdout }} | ||
CLIENT_IP: ${{ steps.client.outputs.stdout }} | ||
run: npm run start -- --client-public-ip $CLIENT_IP --server-public-ip $SERVER_IP --test-filter ${{ inputs.test-filter }} | ||
working-directory: perf/runner | ||
|
||
- name: Push | ||
shell: bash | ||
if: github.event.inputs.push == 'true' | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: | | ||
git add benchmark-results.json | ||
git commit -m "perf: update benchmark results" | ||
git push | ||
gh pr comment --body "See new metrics at https://observablehq.com/@libp2p-workspace/performance-dashboard?branch=$(git rev-parse HEAD)" || true | ||
working-directory: perf/runner | ||
|
||
- name: Archive | ||
if: github.event.intputs.push == 'false' | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: benchmark-results | ||
path: perf/runner/benchmark-results.json | ||
|
||
- name: Destroy terraform | ||
shell: bash | ||
if: always() && steps.init.outputs.exitcode == 0 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ inputs.s3-access-key-id }} | ||
AWS_SECRET_ACCESS_KEY: ${{ inputs.s3-secret-access-key }} | ||
TF_IN_AUTOMATION: "1" | ||
TF_INPUT: "0" | ||
run: terraform destroy -auto-approve | ||
working-directory: perf/terraform/configs/local |
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
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
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