Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add connectivity tests for circuit v2 #147

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions .github/actions/run-interop-relay-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: "libp2p relay interop test"
description: "Run the libp2p relay interoperability test suite"
inputs:
test-filter:
description: "Filter which tests to run out of the created matrix"
required: false
default: ""
extra-versions:
description: "Space-separated paths to JSON files describing additional images"
required: false
default: ""
s3-cache-bucket:
description: "Which S3 bucket to use for container layer caching"
required: false
default: ""
s3-access-key-id:
description: "S3 Access key id for the cache"
required: false
default: ""
s3-secret-access-key:
description: "S3 secret key id for the cache"
required: false
default: ""
aws-region:
description: "Which AWS region to use"
required: false
default: "us-east-1"
runs:
using: "composite"
steps:
- if: inputs.s3-access-key-id != '' && inputs.s3-secret-access-key != ''
run: |
echo "AWS_BUCKET=${{ inputs.s3-cache-bucket }}" >> $GITHUB_ENV
echo "AWS_REGION=${{ inputs.aws-region }}" >> $GITHUB_ENV
shell: bash

- name: Configure AWS credentials for S3 build cache
if: inputs.s3-access-key-id != '' && inputs.s3-secret-access-key != ''
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ inputs.s3-access-key-id }}
aws-secret-access-key: ${{ inputs.s3-secret-access-key}}
aws-region: ${{ env.AWS_REGION }}

# This depends on where this file is within this repository. This walks up
# from here to the relay folder
- run: |
WORK_DIR=$(realpath "${{ github.action_path }}/../../../relay")
echo "WORK_DIR=$WORK_DIR" >> $GITHUB_OUTPUT
shell: bash
id: find-workdir

- uses: actions/setup-node@v3
with:
node-version: 18

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Install deps
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
run: npm ci
shell: bash

- name: Build images
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
run: make
shell: bash

- name: Run the test
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
run: WORKER_COUNT=2 npm run test -- --extra-version=${{ inputs.extra-versions }} --name-filter=${{ inputs.test-filter }}
shell: bash

- name: Print the results
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
run: cat results.csv
shell: bash

# TODO
# - name: Render results
# working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
# run: npm run renderResults > ./dashboard.md
# shell: bash

# TODO
# - name: Show Dashboard Output
# working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
# run: cat ./dashboard.md >> $GITHUB_STEP_SUMMARY
# shell: bash

- name: Exit with Error
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
run: |
if grep -q ":red_circle:" ./dashboard.md; then
exit 1
else
exit 0
fi
shell: bash

- uses: actions/upload-artifact@v3
with:
name: test-plans-output
path: |
${{ steps.find-workdir.outputs.WORK_DIR }}/results.csv
${{ steps.find-workdir.outputs.WORK_DIR }}/dashboard.md
28 changes: 28 additions & 0 deletions .github/workflows/relay.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
workflow_dispatch:
pull_request:
push:
branches:
- "master"

name: libp2p interop relay test

jobs:
run-interop-relay:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/run-interop-relay-test
with:
s3-cache-bucket: libp2p-by-tf-aws-bootstrap
s3-access-key-id: ${{ vars.S3_AWS_ACCESS_KEY_ID }}
s3-secret-access-key: ${{ secrets.S3_AWS_SECRET_ACCESS_KEY }}
build-without-cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Purposely not using cache to replicate how forks will behave.
- uses: ./.github/actions/run-interop-relay-test
with:
# It's okay to not run the tests, we only care to check if the tests build without cache.
test-filter: '"no test matches this, skip all"'
8 changes: 8 additions & 0 deletions relay/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
RUST_SUBDIRS := $(wildcard rust/*/.)

all: $(RUST_SUBDIRS)
$(RUST_SUBDIRS):
$(MAKE) -C $@


.PHONY: $(RUST_SUBDIRS)
Loading