Compare commits

11 changed files with 514 additions and 421 deletions
@@ -36,6 +36,50 @@ inputs:
runs:
using: "composite"
steps:
# - name: List caches via API
# shell: bash
# run: |
# ENDPOINT=${{ github.api_url }}/repos/${{ github.repository }}/actions/caches
# curl -L \
# $ENDPOINT
# # curl -L \
# # $ENDPOINT/my-tmp-cache
# - name: Fetch tmp cache
# uses: actions/cache@v3
# id: fetch-tmp-cache
# with:
# path: /tmp/cache
# key: my-tmp-cache
# - name: Create tmp cache if not exists
# shell: bash
# if: steps.fetch-tmp-cache.outputs.cache-hit != 'true'
# run: |
# mkdir -p /tmp/cache
# echo "Hello, World!" > /tmp/cache/hello.txt
# - name: Get values
# shell: bash
# run: |
# echo ${{ github.api_url }}
# echo ${{ github.event_name }}
# echo ${{ github.repository }}
# echo ${{ github.repositoryUrl }}
# SECRET=${{ github.token }}
# echo ${SECRET:0:4}
# - name: Restore image from cache
# id: deps-cache
# uses: actions/cache@v3
# with:
# path: nimbledeps
# # Using nim.branch as a simple way to differentiate between nimble using the "pkgs" or "pkgs2" directories.
# # The change happened on Nimble v0.14.0.
# key: nimbledeps-${{ matrix.nim.branch }}-${{ hashFiles('.pinned') }} # hashFiles returns a different value on windows
# -----< CACHED STEPS >-----
- name: Configure AWS credentials for S3 build cache
if: inputs.s3-access-key-id != '' && inputs.s3-secret-access-key != ''
run: |
@@ -91,55 +135,57 @@ runs:
exit 1
fi
- name: Push the image cache
if: env.PUSH_CACHE == 'true'
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
env:
AWS_BUCKET: ${{ inputs.s3-cache-bucket }}
AWS_REGION: ${{ inputs.aws-region }}
AWS_ACCESS_KEY_ID: ${{ inputs.s3-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.s3-secret-access-key }}
run: npm run cache -- push
shell: bash
# - name: Push the image cache
# if: env.PUSH_CACHE == 'true'
# working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
# env:
# AWS_BUCKET: ${{ inputs.s3-cache-bucket }}
# AWS_REGION: ${{ inputs.aws-region }}
# AWS_ACCESS_KEY_ID: ${{ inputs.s3-access-key-id }}
# AWS_SECRET_ACCESS_KEY: ${{ inputs.s3-secret-access-key }}
# run: npm run cache -- push
# shell: bash
- name: Run the test
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
env:
WORKER_COUNT: ${{ inputs.worker-count }}
EXTRA_VERSION: ${{ inputs.extra-versions }}
NAME_FILTER: ${{ inputs.test-filter }}
NAME_IGNORE: ${{ inputs.test-ignore }}
run: npm run test -- --extra-version=$EXTRA_VERSION --name-filter=$NAME_FILTER --name-ignore=$NAME_IGNORE
shell: bash
# -----< CACHED STEPS >-----
- name: Print the results
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
run: cat results.csv
shell: bash
# - name: Run the test
# working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
# env:
# WORKER_COUNT: ${{ inputs.worker-count }}
# EXTRA_VERSION: ${{ inputs.extra-versions }}
# NAME_FILTER: ${{ inputs.test-filter }}
# NAME_IGNORE: ${{ inputs.test-ignore }}
# run: npm run test -- --extra-version=$EXTRA_VERSION --name-filter=$NAME_FILTER --name-ignore=$NAME_IGNORE
# shell: bash
- name: Render results
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
run: npm run renderResults > ./dashboard.md
shell: bash
# - name: Print the results
# working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
# run: cat results.csv
# shell: bash
- name: Show Dashboard Output
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
run: cat ./dashboard.md >> $GITHUB_STEP_SUMMARY
shell: bash
# - name: Render results
# working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
# run: npm run renderResults > ./dashboard.md
# 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
# - name: Show Dashboard Output
# working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
# run: cat ./dashboard.md >> $GITHUB_STEP_SUMMARY
# 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
# - 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
+143 -143
View File
@@ -1,152 +1,152 @@
name: Add new implementation versions
# name: Add new implementation versions
on:
workflow_dispatch:
schedule:
# “At minute 36 past every 24th hour.” - https://crontab.guru/#36_*/24_*_*_*
- cron: '36 */24 * * *'
# on:
# workflow_dispatch:
# schedule:
# # “At minute 36 past every 24th hour.” - https://crontab.guru/#36_*/24_*_*_*
# - cron: '36 */24 * * *'
defaults:
run:
shell: bash
# defaults:
# run:
# shell: bash
permissions:
contents: write
pull-requests: write
actions: write
# permissions:
# contents: write
# pull-requests: write
# actions: write
jobs:
add:
name: Add new ${{ matrix.repository_name }} version to ${{ matrix.test_name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- repository_name: go-libp2p
implementation_name: go-libp2p
test_name: perf
implementation_update_script: |
sed -i "1s/$LOCAL_MAJOR_MINOR_VERSION/$REMOTE_MAJOR_MINOR_VERSION/g" go.mod
go mod tidy -go=$GO_MAJOR_MINOR_VERSION
go mod tidy
go get github.com/libp2p/go-libp2p@$REMOTE_VERSION
- repository_name: go-libp2p
implementation_name: go
test_name: transport-interop
implementation_update_script: |
sed -i "s/image_name := go-${LOCAL_MAJOR_MINOR_VERSION}/image_name := go-${REMOTE_MAJOR_MINOR_VERSION}/g" Makefile
sed -i "s/version := ${LOCAL_MAJOR_MINOR_VERSION#v}\..*/version := ${REMOTE_VERSION#v}/g" Makefile
make version.lock
- repository_name: rust-libp2p
implementation_name: rust-libp2p
test_name: perf
implementation_update_script: |
sed -i "s/commitSha := .*/commitSha := ${REMOTE_SHA}/g" Makefile
- repository_name: rust-libp2p
implementation_name: rust
test_name: transport-interop
implementation_update_script: |
sed -i "s/image_name := rust-${LOCAL_MAJOR_MINOR_VERSION}/image_name := rust-${REMOTE_MAJOR_MINOR_VERSION}/g" Makefile
sed -i "s/commitSha := .*/commitSha := ${REMOTE_SHA}/g" Makefile
- repository_name: js-libp2p
implementation_name: js-libp2p
test_name: perf
implementation_update_script: |
suffix="$(echo "${REMOTE_MAJOR_MINOR_VERSION#v}" | sed 's/\./-/g')"
sed -i "s/perf-js-libp2p-[^\"]*/perf-js-libp2p-$suffix/g" package.json
npm install libp2p@$REMOTE_VERSION
- repository_name: js-libp2p
implementation_name: js
test_name: transport-interop
implementation_update_script: |
sed -i "s/image_name := js-${LOCAL_MAJOR_MINOR_VERSION}\..*/image_name := js-${REMOTE_VERSION}/g" Makefile
npm install libp2p@$REMOTE_VERSION
env:
BRANCH: add/${{ matrix.test_name }}/${{ matrix.repository_name }}
steps:
- name: Checkout test-plans
uses: actions/checkout@v4
- name: Configure git
run: |
git fetch origin $BRANCH && git checkout $BRANCH || git checkout -b $BRANCH
git rebase $GITHUB_REF -X theirs || git rebase --abort
git config --global user.email $GITHUB_ACTOR@users.noreply.github.com
git config --global user.name $GITHUB_ACTOR
- id: go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Get the latest version (local)
id: local
env:
IMPLEMENTATION_DIRECTORY: ${{ matrix.test_name }}/impl/${{ matrix.implementation_name }}
run: |
pushd $IMPLEMENTATION_DIRECTORY
ls -d v* | sort -V | tail -n-1 | xargs -I{} echo "version={}" | tee -a $GITHUB_OUTPUT
popd
- name: Get the latest version (remote)
id: remote
env:
GITHUB_TOKEN: ${{ github.token }}
REPOSITORY_NAME: ${{ matrix.repository_name }}
run: |
releases="$(gh api --paginate repos/libp2p/$REPOSITORY_NAME/releases)"
latest="$(jq 'map(select(.tag_name | startswith("libp2p-"))) | first' <<< "$releases")"
if [[ "$latest" == "null" ]]; then
latest="$(jq 'first' <<< "$releases")"
fi
tag_name=$(jq -r '.tag_name' <<< "$latest")
target_commitish=$(jq -r '.target_commitish' <<< "$latest")
echo "version=${tag_name#libp2p-}" | tee -a $GITHUB_OUTPUT
echo "target_commitish=${target_commitish}" | tee -a $GITHUB_OUTPUT
- id: mm
env:
REMOTE_VERSION: ${{ steps.remote.outputs.version }}
GO_VERSION: ${{ steps.go.outputs.go-version }}
run: |
echo $REMOTE_VERSION | sed 's/\.[0-9]*$//' | xargs -I{} echo "remote={}" | tee -a $GITHUB_OUTPUT
echo $GO_VERSION | sed 's/\.[0-9]*$//' | xargs -I{} echo "go={}" | tee -a $GITHUB_OUTPUT
- name: Add the latest version
if: ${{ !startsWith(steps.remote.outputs.version, steps.local.outputs.version) }}
env:
LOCAL_MAJOR_MINOR_VERSION: ${{ steps.local.outputs.version }}
REMOTE_VERSION: ${{ steps.remote.outputs.version }}
REMOTE_MAJOR_MINOR_VERSION: ${{ steps.mm.outputs.remote }}
REMOTE_SHA: ${{ steps.remote.outputs.sha }}
GO_VERSION: ${{ steps.go.outputs.go-version }}
GO_MAJOR_MINOR_VERSION: ${{ steps.mm.outputs.go }}
GITHUB_TOKEN: ${{ github.token }}
IMPLEMENTATION_DIRECTORY: ${{ matrix.test_name }}/impl/${{ matrix.implementation_name }}
VERSIONS_DIRECTORY: ${{ matrix.test_name == 'perf' && format('{0}/runner', matrix.test_name) || matrix.test_name }}
IMPLEMENTATION_NAME: ${{ matrix.implementation_name }}
REPOSITORY_NAME: ${{ matrix.repository_name }}
TEST_NAME: ${{ matrix.test_name }}
run: |
pushd $IMPLEMENTATION_DIRECTORY
cp -r $LOCAL_MAJOR_MINOR_VERSION $REMOTE_MAJOR_MINOR_VERSION
pushd $REMOTE_MAJOR_MINOR_VERSION
${{ matrix.implementation_update_script }}
popd
popd
# jobs:
# add:
# name: Add new ${{ matrix.repository_name }} version to ${{ matrix.test_name }}
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# include:
# - repository_name: go-libp2p
# implementation_name: go-libp2p
# test_name: perf
# implementation_update_script: |
# sed -i "1s/$LOCAL_MAJOR_MINOR_VERSION/$REMOTE_MAJOR_MINOR_VERSION/g" go.mod
# go mod tidy -go=$GO_MAJOR_MINOR_VERSION
# go mod tidy
# go get github.com/libp2p/go-libp2p@$REMOTE_VERSION
# - repository_name: go-libp2p
# implementation_name: go
# test_name: transport-interop
# implementation_update_script: |
# sed -i "s/image_name := go-${LOCAL_MAJOR_MINOR_VERSION}/image_name := go-${REMOTE_MAJOR_MINOR_VERSION}/g" Makefile
# sed -i "s/version := ${LOCAL_MAJOR_MINOR_VERSION#v}\..*/version := ${REMOTE_VERSION#v}/g" Makefile
# make version.lock
# - repository_name: rust-libp2p
# implementation_name: rust-libp2p
# test_name: perf
# implementation_update_script: |
# sed -i "s/commitSha := .*/commitSha := ${REMOTE_SHA}/g" Makefile
# - repository_name: rust-libp2p
# implementation_name: rust
# test_name: transport-interop
# implementation_update_script: |
# sed -i "s/image_name := rust-${LOCAL_MAJOR_MINOR_VERSION}/image_name := rust-${REMOTE_MAJOR_MINOR_VERSION}/g" Makefile
# sed -i "s/commitSha := .*/commitSha := ${REMOTE_SHA}/g" Makefile
# - repository_name: js-libp2p
# implementation_name: js-libp2p
# test_name: perf
# implementation_update_script: |
# suffix="$(echo "${REMOTE_MAJOR_MINOR_VERSION#v}" | sed 's/\./-/g')"
# sed -i "s/perf-js-libp2p-[^\"]*/perf-js-libp2p-$suffix/g" package.json
# npm install libp2p@$REMOTE_VERSION
# - repository_name: js-libp2p
# implementation_name: js
# test_name: transport-interop
# implementation_update_script: |
# sed -i "s/image_name := js-${LOCAL_MAJOR_MINOR_VERSION}\..*/image_name := js-${REMOTE_VERSION}/g" Makefile
# npm install libp2p@$REMOTE_VERSION
# env:
# BRANCH: add/${{ matrix.test_name }}/${{ matrix.repository_name }}
# steps:
# - name: Checkout test-plans
# uses: actions/checkout@v4
# - name: Configure git
# run: |
# git fetch origin $BRANCH && git checkout $BRANCH || git checkout -b $BRANCH
# git rebase $GITHUB_REF -X theirs || git rebase --abort
# git config --global user.email $GITHUB_ACTOR@users.noreply.github.com
# git config --global user.name $GITHUB_ACTOR
# - id: go
# uses: actions/setup-go@v5
# with:
# go-version: stable
# - name: Get the latest version (local)
# id: local
# env:
# IMPLEMENTATION_DIRECTORY: ${{ matrix.test_name }}/impl/${{ matrix.implementation_name }}
# run: |
# pushd $IMPLEMENTATION_DIRECTORY
# ls -d v* | sort -V | tail -n-1 | xargs -I{} echo "version={}" | tee -a $GITHUB_OUTPUT
# popd
# - name: Get the latest version (remote)
# id: remote
# env:
# GITHUB_TOKEN: ${{ github.token }}
# REPOSITORY_NAME: ${{ matrix.repository_name }}
# run: |
# releases="$(gh api --paginate repos/libp2p/$REPOSITORY_NAME/releases)"
# latest="$(jq 'map(select(.tag_name | startswith("libp2p-"))) | first' <<< "$releases")"
# if [[ "$latest" == "null" ]]; then
# latest="$(jq 'first' <<< "$releases")"
# fi
# tag_name=$(jq -r '.tag_name' <<< "$latest")
# target_commitish=$(jq -r '.target_commitish' <<< "$latest")
# echo "version=${tag_name#libp2p-}" | tee -a $GITHUB_OUTPUT
# echo "target_commitish=${target_commitish}" | tee -a $GITHUB_OUTPUT
# - id: mm
# env:
# REMOTE_VERSION: ${{ steps.remote.outputs.version }}
# GO_VERSION: ${{ steps.go.outputs.go-version }}
# run: |
# echo $REMOTE_VERSION | sed 's/\.[0-9]*$//' | xargs -I{} echo "remote={}" | tee -a $GITHUB_OUTPUT
# echo $GO_VERSION | sed 's/\.[0-9]*$//' | xargs -I{} echo "go={}" | tee -a $GITHUB_OUTPUT
# - name: Add the latest version
# if: ${{ !startsWith(steps.remote.outputs.version, steps.local.outputs.version) }}
# env:
# LOCAL_MAJOR_MINOR_VERSION: ${{ steps.local.outputs.version }}
# REMOTE_VERSION: ${{ steps.remote.outputs.version }}
# REMOTE_MAJOR_MINOR_VERSION: ${{ steps.mm.outputs.remote }}
# REMOTE_SHA: ${{ steps.remote.outputs.sha }}
# GO_VERSION: ${{ steps.go.outputs.go-version }}
# GO_MAJOR_MINOR_VERSION: ${{ steps.mm.outputs.go }}
# GITHUB_TOKEN: ${{ github.token }}
# IMPLEMENTATION_DIRECTORY: ${{ matrix.test_name }}/impl/${{ matrix.implementation_name }}
# VERSIONS_DIRECTORY: ${{ matrix.test_name == 'perf' && format('{0}/runner', matrix.test_name) || matrix.test_name }}
# IMPLEMENTATION_NAME: ${{ matrix.implementation_name }}
# REPOSITORY_NAME: ${{ matrix.repository_name }}
# TEST_NAME: ${{ matrix.test_name }}
# run: |
# pushd $IMPLEMENTATION_DIRECTORY
# cp -r $LOCAL_MAJOR_MINOR_VERSION $REMOTE_MAJOR_MINOR_VERSION
# pushd $REMOTE_MAJOR_MINOR_VERSION
# ${{ matrix.implementation_update_script }}
# popd
# popd
pushd $VERSIONS_DIRECTORY
versions=''
if [[ "$TEST_NAME" == "perf" ]]; then
versions="$(jq '. + map(select(.implementation == env.IMPLEMENTATION_NAME and .id == env.LOCAL_MAJOR_MINOR_VERSION) | .id = env.REMOTE_MAJOR_MINOR_VERSION)' versionsInput.json)"
else
versions="$(jq '. + map(select(.id == "\(env.IMPLEMENTATION_NAME)-\(env.LOCAL_MAJOR_MINOR_VERSION)") | .id = "\(env.IMPLEMENTATION_NAME)-\(env.REMOTE_MAJOR_MINOR_VERSION)")' versionsInput.json)"
fi
echo "$versions" > versionsInput.json
popd
# pushd $VERSIONS_DIRECTORY
# versions=''
# if [[ "$TEST_NAME" == "perf" ]]; then
# versions="$(jq '. + map(select(.implementation == env.IMPLEMENTATION_NAME and .id == env.LOCAL_MAJOR_MINOR_VERSION) | .id = env.REMOTE_MAJOR_MINOR_VERSION)' versionsInput.json)"
# else
# versions="$(jq '. + map(select(.id == "\(env.IMPLEMENTATION_NAME)-\(env.LOCAL_MAJOR_MINOR_VERSION)") | .id = "\(env.IMPLEMENTATION_NAME)-\(env.REMOTE_MAJOR_MINOR_VERSION)")' versionsInput.json)"
# fi
# echo "$versions" > versionsInput.json
# popd
git add .
git commit -m "chore: add $REPOSITORY_NAME@$REMOTE_VERSION to $TEST_NAME"
# git add .
# git commit -m "chore: add $REPOSITORY_NAME@$REMOTE_VERSION to $TEST_NAME"
git push origin $BRANCH --force
# git push origin $BRANCH --force
if [[ $(gh pr list --state open --base $GITHUB_REF --head $BRANCH | wc -l) -eq 0 ]]; then
gh pr create --title "chore: add $REPOSITORY_NAME@$REMOTE_VERSION to $TEST_NAME" --body "This PR adds $REPOSITORY_NAME@$REMOTE_VERSION to $TEST_NAME" --head $BRANCH --base $GITHUB_REF
fi
# if [[ $(gh pr list --state open --base $GITHUB_REF --head $BRANCH | wc -l) -eq 0 ]]; then
# gh pr create --title "chore: add $REPOSITORY_NAME@$REMOTE_VERSION to $TEST_NAME" --body "This PR adds $REPOSITORY_NAME@$REMOTE_VERSION to $TEST_NAME" --head $BRANCH --base $GITHUB_REF
# fi
gh workflow run $TEST_NAME.yml --ref $BRANCH
# gh workflow run $TEST_NAME.yml --ref $BRANCH
+31 -31
View File
@@ -1,34 +1,34 @@
on:
workflow_dispatch:
pull_request:
paths:
- 'hole-punch-interop/**'
push:
branches:
- "master"
paths:
- 'hole-punch-interop/**'
# on:
# workflow_dispatch:
# pull_request:
# paths:
# - 'hole-punch-interop/**'
# push:
# branches:
# - "master"
# paths:
# - 'hole-punch-interop/**'
name: libp2p holepunching interop test
# name: libp2p holepunching interop test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}
# cancel-in-progress: true
jobs:
run-hole-punch-interop:
runs-on: ['self-hosted', 'linux', 'x64', '4xlarge'] # https://github.com/pl-strflt/tf-aws-gh-runner/blob/main/runners.tf
# Uncomment to test for flakiness.
# strategy:
# matrix:
# dim1: ['a', 'b', 'c', 'd', 'e']
# dim2: [1, 2, 3, 4, 5]
# fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/run-interop-hole-punch-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 }}
worker-count: 16
# jobs:
# run-hole-punch-interop:
# runs-on: ['self-hosted', 'linux', 'x64', '4xlarge'] # https://github.com/pl-strflt/tf-aws-gh-runner/blob/main/runners.tf
# # Uncomment to test for flakiness.
# # strategy:
# # matrix:
# # dim1: ['a', 'b', 'c', 'd', 'e']
# # dim2: [1, 2, 3, 4, 5]
# # fail-fast: false
# steps:
# - uses: actions/checkout@v3
# - uses: ./.github/actions/run-interop-hole-punch-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 }}
# worker-count: 16
+101 -101
View File
@@ -1,104 +1,104 @@
name: libp2p perf test
# name: libp2p perf test
# How to configure a repository for running this workflow:
# 1. Configure auth for the AWS provider as per https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration
# 2. Run 'terraform init' and 'terraform apply' in 'perf/terraform/configs/remote' to create the resources needed for this workflow
# 3. Go to https://console.aws.amazon.com/iamv2/home?#/users/details/perf?section=security_credentials
# 4. Click 'Create access key' to get the access key ID and secret access key
# 5. Go to https://github.com/libp2p/test-plans/settings/secrets/actions
# 6. Click 'New repository secret', set the name to 'PERF_AWS_SECRET_ACCESS_KEY', and paste the secret access key from step 5
# 7. Go to https://github.com/libp2p/test-plans/settings/variables/actions
# 8. Click 'New repository variable', set the name to 'PERF_AWS_ACCESS_KEY_ID', and paste the access key ID from step 5
# # How to configure a repository for running this workflow:
# # 1. Configure auth for the AWS provider as per https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration
# # 2. Run 'terraform init' and 'terraform apply' in 'perf/terraform/configs/remote' to create the resources needed for this workflow
# # 3. Go to https://console.aws.amazon.com/iamv2/home?#/users/details/perf?section=security_credentials
# # 4. Click 'Create access key' to get the access key ID and secret access key
# # 5. Go to https://github.com/libp2p/test-plans/settings/secrets/actions
# # 6. Click 'New repository secret', set the name to 'PERF_AWS_SECRET_ACCESS_KEY', and paste the secret access key from step 5
# # 7. Go to https://github.com/libp2p/test-plans/settings/variables/actions
# # 8. Click 'New repository variable', set the name to 'PERF_AWS_ACCESS_KEY_ID', and paste the access key ID from step 5
on:
workflow_dispatch:
inputs:
push:
description: 'Push the benchmark results to the repository'
required: false
default: 'true'
# on:
# workflow_dispatch:
# inputs:
# push:
# description: 'Push the benchmark results to the repository'
# required: false
# default: 'true'
jobs:
perf:
name: Perf
runs-on: ubuntu-latest
timeout-minutes: 240
defaults:
run:
shell: bash
working-directory: perf
env:
AWS_ACCESS_KEY_ID: ${{ vars.PERF_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PERF_AWS_SECRET_ACCESS_KEY }}
TF_IN_AUTOMATION: 1
TF_INPUT: 0
steps:
- name: Checkout test-plans
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}
ref: ${{ github.ref }}
- id: ssh
name: Generate SSH key
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
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
run: terraform init
working-directory: perf/terraform/configs/local
- name: Apply terraform
run: terraform apply -auto-approve
working-directory: perf/terraform/configs/local
- id: server
name: Retrieve server's IP
run: terraform output -raw server_ip
working-directory: perf/terraform/configs/local
- id: client
name: Retrieve client's IP
run: terraform output -raw client_ip
working-directory: perf/terraform/configs/local
- name: Download dependencies
run: npm ci
working-directory: perf/runner
- name: Run tests
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
working-directory: perf/runner
- name: Push
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
if: always() && steps.init.outputs.exitcode == 0
run: terraform destroy -auto-approve
working-directory: perf/terraform/configs/local
# jobs:
# perf:
# name: Perf
# runs-on: ubuntu-latest
# timeout-minutes: 240
# defaults:
# run:
# shell: bash
# working-directory: perf
# env:
# AWS_ACCESS_KEY_ID: ${{ vars.PERF_AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.PERF_AWS_SECRET_ACCESS_KEY }}
# TF_IN_AUTOMATION: 1
# TF_INPUT: 0
# steps:
# - name: Checkout test-plans
# uses: actions/checkout@v3
# with:
# repository: ${{ github.repository }}
# ref: ${{ github.ref }}
# - id: ssh
# name: Generate SSH key
# 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
# 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
# run: terraform init
# working-directory: perf/terraform/configs/local
# - name: Apply terraform
# run: terraform apply -auto-approve
# working-directory: perf/terraform/configs/local
# - id: server
# name: Retrieve server's IP
# run: terraform output -raw server_ip
# working-directory: perf/terraform/configs/local
# - id: client
# name: Retrieve client's IP
# run: terraform output -raw client_ip
# working-directory: perf/terraform/configs/local
# - name: Download dependencies
# run: npm ci
# working-directory: perf/runner
# - name: Run tests
# 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
# working-directory: perf/runner
# - name: Push
# 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
# if: always() && steps.init.outputs.exitcode == 0
# run: terraform destroy -auto-approve
# working-directory: perf/terraform/configs/local
+10 -10
View File
@@ -1,13 +1,13 @@
name: Close and mark stale issue
# name: Close and mark stale issue
on:
schedule:
- cron: '0 0 * * *'
# on:
# schedule:
# - cron: '0 0 * * *'
permissions:
issues: write
pull-requests: write
# permissions:
# issues: write
# pull-requests: write
jobs:
stale:
uses: pl-strflt/.github/.github/workflows/reusable-stale-issue.yml@v0.3
# jobs:
# stale:
# uses: pl-strflt/.github/.github/workflows/reusable-stale-issue.yml@v0.3
+53 -10
View File
@@ -13,7 +13,8 @@ name: libp2p transport interop test
jobs:
run-transport-interop:
runs-on: ['self-hosted', 'linux', 'x64', '4xlarge'] # https://github.com/pl-strflt/tf-aws-gh-runner/blob/main/runners.tf
# runs-on: ['self-hosted', 'linux', 'x64', '4xlarge'] # https://github.com/pl-strflt/tf-aws-gh-runner/blob/main/runners.tf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/run-transport-interop-test
@@ -22,12 +23,54 @@ jobs:
s3-access-key-id: ${{ vars.S3_AWS_ACCESS_KEY_ID }}
s3-secret-access-key: ${{ secrets.S3_AWS_SECRET_ACCESS_KEY }}
worker-count: 16
build-without-secrets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Purposely not using secrets to replicate how forks will behave.
- uses: ./.github/actions/run-transport-interop-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"'
# build-without-secrets:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# # Purposely not using secrets to replicate how forks will behave.
# - uses: ./.github/actions/run-transport-interop-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"'
# build-docker-container-and-cache:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
# - name: Compute file hash
# run: |
# echo "Computing file hash"
# # echo "File hash: ${{ hashFiles('**') }}"
# ARCH=docker info -f "{{.Architecture}}"
# echo $ARCH
# ls /var/lib/docker
# # - name: Fetch cache
# # uses: actions/cache@v4
# # id: fetch-cache
# # with:
# # path: /tmp/cache
# # key: ${{ runner.os }}-docker-${{ hashFiles('**') }}
# # - name: Build docker container
# # if: steps.cache.outputs.cache-hit != 'true'
# # id: docker-build
# # run: |
# # echo "Building docker container"
# # - name: Dump docker container
# # if: steps.docker-build.conclusion == 'success'
# # run: |
# # echo "Dumping docker container"
# - name: Load docker container
# run: |
# echo "Loading docker container"
# - name: Hello world
# run: |
# echo "Hello, World!"
+69 -69
View File
@@ -1,79 +1,79 @@
name: Update Badge
# name: Update Badge
on:
workflow_run:
workflows:
- libp2p transport interop test
types:
- completed
branches:
- master
# on:
# workflow_run:
# workflows:
# - libp2p transport interop test
# types:
# - completed
# branches:
# - master
defaults:
run:
shell: bash
# defaults:
# run:
# shell: bash
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
# concurrency:
# group: ${{ github.workflow }}
# cancel-in-progress: true
env:
BADGE_NAME: Interop Dashboard
# env:
# BADGE_NAME: Interop Dashboard
jobs:
update-badge:
runs-on: ubuntu-latest
steps:
- id: workflow
env:
WORKFLOW_PATH: ${{ github.event.workflow.path }}
run: echo "name=${WORKFLOW_PATH#.github/workflows/}" >> $GITHUB_OUTPUT
- uses: pl-strflt/job-summary-url-action@v1
id: metadata
with:
workflow: ${{ steps.workflow.outputs.name }}
run_id: ${{ github.event.workflow_run.id }}
run_attempt: ${{ github.event.workflow_run.run_attempt }}
job: latest
- uses: actions/checkout@v3
- id: update
uses: actions/github-script@v6
env:
BADGE_URL: ${{ github.event.workflow.badge_url }}
SUMMARY_URL: ${{ steps.metadata.outputs.job_summary_url }}
with:
script: |
const fs = require('fs')
# jobs:
# update-badge:
# runs-on: ubuntu-latest
# steps:
# - id: workflow
# env:
# WORKFLOW_PATH: ${{ github.event.workflow.path }}
# run: echo "name=${WORKFLOW_PATH#.github/workflows/}" >> $GITHUB_OUTPUT
# - uses: pl-strflt/job-summary-url-action@v1
# id: metadata
# with:
# workflow: ${{ steps.workflow.outputs.name }}
# run_id: ${{ github.event.workflow_run.id }}
# run_attempt: ${{ github.event.workflow_run.run_attempt }}
# job: latest
# - uses: actions/checkout@v3
# - id: update
# uses: actions/github-script@v6
# env:
# BADGE_URL: ${{ github.event.workflow.badge_url }}
# SUMMARY_URL: ${{ steps.metadata.outputs.job_summary_url }}
# with:
# script: |
# const fs = require('fs')
const badgeName = process.env.BADGE_NAME
const badgeURL = process.env.BADGE_URL
const refName = process.env.GITHUB_REF_NAME
const summaryURL = process.env.SUMMARY_URL
# const badgeName = process.env.BADGE_NAME
# const badgeURL = process.env.BADGE_URL
# const refName = process.env.GITHUB_REF_NAME
# const summaryURL = process.env.SUMMARY_URL
const searchValue = new RegExp(`\\[!\\[${badgeName}\\]\\(.*\\)\\]\\(.*\\)`, 'g')
const replaceValue = `[![${badgeName}](${badgeURL}?branch=${refName})](${summaryURL})`
# const searchValue = new RegExp(`\\[!\\[${badgeName}\\]\\(.*\\)\\]\\(.*\\)`, 'g')
# const replaceValue = `[![${badgeName}](${badgeURL}?branch=${refName})](${summaryURL})`
console.log(`Searching for: ${searchValue}`)
console.log(`To replace it with: ${replaceValue}`)
# console.log(`Searching for: ${searchValue}`)
# console.log(`To replace it with: ${replaceValue}`)
const readme = fs.readFileSync('README.md').toString()
const updatedReadme = readme.replace(searchValue, replaceValue)
# const readme = fs.readFileSync('README.md').toString()
# const updatedReadme = readme.replace(searchValue, replaceValue)
if (readme !== updatedReadme) {
console.log('Updating README')
fs.writeFileSync('README.md', updatedReadme)
return true
} else {
console.log('README does not need to be updated')
return false
}
# https://github.com/orgs/community/discussions/26560
- if: steps.update.outputs.result == 'true'
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
- if: steps.update.outputs.result == 'true'
run: |
git add README.md
git commit -m 'chore: update the link to the interop dashboard [skip ci]'
git push
# if (readme !== updatedReadme) {
# console.log('Updating README')
# fs.writeFileSync('README.md', updatedReadme)
# return true
# } else {
# console.log('README does not need to be updated')
# return false
# }
# # https://github.com/orgs/community/discussions/26560
# - if: steps.update.outputs.result == 'true'
# run: |
# git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# git config user.name "github-actions[bot]"
# - if: steps.update.outputs.result == 'true'
# run: |
# git add README.md
# git commit -m 'chore: update the link to the interop dashboard [skip ci]'
# git push
+9 -5
View File
@@ -2,11 +2,15 @@
CACHING_OPTIONS=""
# If in CI and we have a defined cache bucket, use caching
if [[ -n "${CI}" ]] && [[ -n "${AWS_BUCKET}" ]]; then
CACHING_OPTIONS="\
--cache-to type=s3,mode=max,bucket=$AWS_BUCKET,region=$AWS_REGION,prefix=buildCache,name=$IMAGE_NAME \
--cache-from type=s3,mode=max,bucket=$AWS_BUCKET,region=$AWS_REGION,prefix=buildCache,name=$IMAGE_NAME"
fi
# if [[ -n "${CI}" ]] && [[ -n "${AWS_BUCKET}" ]]; then
# CACHING_OPTIONS="\
# --cache-to type=s3,mode=max,bucket=$AWS_BUCKET,region=$AWS_REGION,prefix=buildCache,name=$IMAGE_NAME \
# --cache-from type=s3,mode=max,bucket=$AWS_BUCKET,region=$AWS_REGION,prefix=buildCache,name=$IMAGE_NAME"
# fi
CACHING_OPTIONS="\
--cache-to type=gha,mode=max \
--cache-from type=gha,mode=max"
docker buildx build \
--load \
+2 -2
View File
@@ -18,10 +18,10 @@ go-libp2p-${version}.zip:
# This locks the exact contents of the specified version. This lets us use the
# human readable name while still making sure the contents don't change.
version.lock: go-libp2p-${version}.zip
shasum -a 256 go-libp2p-${version}.zip > $@
sha256sum go-libp2p-${version}.zip > $@
verify-checksum: go-libp2p-${version}.zip
shasum -a 256 -c version.lock
sha256sum -c version.lock
.PHONY: clean all verify-checksum
+2 -2
View File
@@ -18,10 +18,10 @@ go-libp2p-${version}.zip:
# This locks the exact contents of the specified version. This lets us use the
# human readable name while still making sure the contents don't change.
version.lock: go-libp2p-${version}.zip
shasum -a 256 go-libp2p-${version}.zip > $@
sha256sum go-libp2p-${version}.zip > $@
verify-checksum: go-libp2p-${version}.zip
shasum -a 256 -c version.lock
sha256sum -c version.lock
.PHONY: clean all verify-checksum
+2 -2
View File
@@ -18,10 +18,10 @@ go-libp2p-${version}.zip:
# This locks the exact contents of the specified version. This lets us use the
# human readable name while still making sure the contents don't change.
version.lock: go-libp2p-${version}.zip
shasum -a 256 go-libp2p-${version}.zip > $@
sha256sum go-libp2p-${version}.zip > $@
verify-checksum: go-libp2p-${version}.zip
shasum -a 256 -c version.lock
sha256sum -c version.lock
.PHONY: clean all verify-checksum