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(.github): run QUIC Interop Runner #1682

Merged
merged 19 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 16 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
112 changes: 112 additions & 0 deletions .github/actions/quic-interop-runner/action.yml
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest duplicating this in mozilla/neqo for now until quic-interop/quic-interop-runner#356 is merged.

Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: 'QUIC Interop Runner Action'
description: 'Run the QUIC Interop Runner tests.'
author: 'mxinden'

inputs:
name:
description: 'Name of the QUIC implementation'
required: true
image:
description: 'Docker image to be tested. Needs to reside either locally, or on some registry.'
required: true
url:
description: 'URL of the QUIC implementation'
required: true
role:
description: 'client/server/both'
required: false
default: 'both'
client:
description: 'client implementations (comma-separated)'
required: false
default: ''
server:
description: 'server implementations (comma-separated)'
required: false
default: ''
test:
description: 'test cases (comma-separatated)'
required: false
default: ''

runs:
using: "composite"
steps:
- name: Install dependencies
run: |
sudo add-apt-repository ppa:wireshark-dev/stable
sudo apt-get update
sudo apt-get install -y wireshark tshark jq
shell: bash

- uses: actions/setup-python@v4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5

with:
python-version: 3.8

- name: Enable IPv6 support
run: sudo modprobe ip6table_filter
shell: bash

- name: Checkout quic-interop/quic-interop-runner repository
uses: actions/checkout@v2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uses: actions/checkout@v2
uses: actions/checkout@v4

with:
repository: 'quic-interop/quic-interop-runner'
path: 'quic-interop-runner'

- name: Install Python packages
run: |
cd quic-interop-runner
pip install -U pip
pip install -r requirements.txt
shell: bash
Comment on lines +58 to +63
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

07fe740 enables caching. You can see it in action on https://github.com/mozilla/neqo/actions/runs/8176970683/job/22357558169?pr=1682.


- run: docker image ls
shell: bash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debugging leftover?


- name: Run tests
id: test-run
run: |
cd quic-interop-runner
jq --arg key "${{ inputs.name }}" --argjson newEntry '{"image": "${{ inputs.image }}", "url": "${{ inputs.url }}", "role": "${{ inputs.role }}"}' '.[$key] = $newEntry' implementations.json > temp.$$ && mv temp.$$ implementations.json
cat implementations.json
ARGS="--log-dir logs --must-include ${{ inputs.name }}"
if [ -n "${{ inputs.client }}" ]; then
ARGS="$ARGS --client ${{ inputs.client }}"
fi
if [ -n "${{ inputs.server }}" ]; then
ARGS="$ARGS --server ${{ inputs.server }}"
fi
if [ -n "${{ inputs.test }}" ]; then
ARGS="$ARGS --test ${{ inputs.test }}"
fi
python run.py $ARGS 2>&1 | tee summary
shell: bash

- uses: actions/upload-artifact@v4
id: artifact-upload-step
if: always()
with:
name: logs
path: quic-interop-runner/logs

# This action might be running off of a fork and would thus not have write
# permissions on the origin repository. In order to allow a separate
# priviledged action to post a comment on a pull request, upload the
# necessary metadata.
- name: store comment-data
shell: bash
if: github.event_name == 'pull_request'
env:
PULL_REQUEST_NUMBER: ${{ github.event.number }}
run: |
mkdir comment-data
mv quic-interop-runner/summary comment-data/summary
echo $PULL_REQUEST_NUMBER > comment-data/pr-number
echo '${{ steps.artifact-upload-step.outputs.artifact-url }}' > comment-data/logs-url

- name: Upload comment data
uses: actions/upload-artifact@v4
if: github.event_name == 'pull_request'
with:
name: comment-data
path: ./comment-data
54 changes: 54 additions & 0 deletions .github/workflows/qns-comment.yml
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment with the test results on each pull requests will only appear once this workflow is in main.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Post test results as pull request comment.
#
# This is done as a separate workflow as it requires write permissions. The
# tests itself might run off of a fork, i.e. an untrusted environment and should
# thus not be granted write permissions.

name: Comment on the pull request

on:
workflow_run:
workflows: ["QUIC Network Simulator"]
types:
- completed
larseggert marked this conversation as resolved.
Show resolved Hide resolved

jobs:
comment:
permissions:
pull-requests: write
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request'
steps:
- name: Download comment-data
uses: actions/download-artifact@v4
with:
run-id: ${{ github.event.workflow_run.id }}
name: comment-data
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Format GitHub comment
run: |
pwd
ls -la
echo '[**QUIC Interop Runner**](https://github.com/quic-interop/quic-interop-runner)' >> comment
echo '' >> comment
echo '```' >> comment
cat summary >> comment
echo '```' >> comment
echo '' >> comment
echo 'Download artifacts [here](' >> comment
cat logs-url >> comment
echo ').' >> comment
shell: bash

- name: Read PR Number
id: pr-number
run: echo "::set-output name=number::$(cat pr-number)"
shell: bash

- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
with:
filePath: comment
pr_number: ${{ steps.pr-number.outputs.number }}
26 changes: 21 additions & 5 deletions .github/workflows/qns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ on:
workflow_dispatch:
pull_request:
branches: ["main"]
paths:
- 'qns/**'
- '.github/workflows/qns.yml'
merge_group:

jobs:
docker-image:
quic-network-simulator:
runs-on: ubuntu-latest
permissions:
packages: write
Expand Down Expand Up @@ -44,6 +42,7 @@ jobs:
type=raw,value=latest,enable={{is_default_branch}}

- name: Build and push
id: docker_build_and_push
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name != 'pull_request' }}
Expand All @@ -53,4 +52,21 @@ jobs:
RUST_VERSION=stable
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64, linux/arm64
# On pull requests only build amd64 for the sake of CI time.
platforms: ${{ github.event_name == 'pull_request' && 'linux/amd64' || 'linux/amd64, linux/arm64' }}
load: ${{ github.event_name == 'pull_request' }}

- name: Checkout
uses: actions/checkout@v4

- name: Run QUIC Interop tests
if: ${{ github.event_name == 'pull_request' }}
# TODO: Replace once https://github.com/quic-interop/quic-interop-runner/pull/356 is merged.
uses: ./.github/actions/quic-interop-runner
with:
name: 'neqo-latest'
image: ${{ steps.docker_build_and_push.outputs.imageID }}
url: https://github.com/mozilla/neqo
test: handshake
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testcase handshake for now to keep CI time low. I suggest we expand gradually once we gained some experience running the QUIC Interop tests on each pull request. Happy to change.

client: neqo-latest,quic-go,ngtcp2,neqo,msquic
server: neqo-latest,quic-go,ngtcp2,neqo,msquic
Comment on lines +71 to +72
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a strong opinion. Happy to change.

Loading