Skip to content

Commit c751b4e

Browse files
authored
feat(.github): run QUIC Interop Runner (#1682)
* feat(.github): run QUIC Interop Runner Run the QUIC Interop Runner testcases on pull requests when entering the merge queue. * Do not always construct comment * Test for all pull requests to main * Don't build arm64 on pull requests * Use actions/download-artifact * Provide client, server and test argument * Fix action args * Copy action into neqo repo For now until quic-interop/quic-interop-runner#356 is merged. * checkout * yml * introduce folder * load image * Only run interop on pull requests * Remove pull_request path filter * Trigger CI * Cache Python deps * Trigger CI to test python cache
1 parent 6f407c9 commit c751b4e

File tree

3 files changed

+186
-5
lines changed

3 files changed

+186
-5
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: 'QUIC Interop Runner Action'
2+
description: 'Run the QUIC Interop Runner tests.'
3+
author: 'mxinden'
4+
5+
inputs:
6+
name:
7+
description: 'Name of the QUIC implementation'
8+
required: true
9+
image:
10+
description: 'Docker image to be tested. Needs to reside either locally, or on some registry.'
11+
required: true
12+
url:
13+
description: 'URL of the QUIC implementation'
14+
required: true
15+
role:
16+
description: 'client/server/both'
17+
required: false
18+
default: 'both'
19+
client:
20+
description: 'client implementations (comma-separated)'
21+
required: false
22+
default: ''
23+
server:
24+
description: 'server implementations (comma-separated)'
25+
required: false
26+
default: ''
27+
test:
28+
description: 'test cases (comma-separatated)'
29+
required: false
30+
default: ''
31+
32+
runs:
33+
using: "composite"
34+
steps:
35+
- name: Checkout quic-interop/quic-interop-runner repository
36+
uses: actions/checkout@v4
37+
with:
38+
repository: 'quic-interop/quic-interop-runner'
39+
path: 'quic-interop-runner'
40+
41+
- name: Enable IPv6 support
42+
run: sudo modprobe ip6table_filter
43+
shell: bash
44+
45+
- name: Install dependencies
46+
run: |
47+
sudo add-apt-repository ppa:wireshark-dev/stable
48+
sudo apt-get update
49+
sudo apt-get install -y wireshark tshark jq
50+
shell: bash
51+
52+
- uses: actions/setup-python@v5
53+
with:
54+
python-version: 3.8
55+
cache: 'pip'
56+
cache-dependency-path: 'quic-interop-runner/requirements.txt'
57+
58+
- name: Install Python packages
59+
run: |
60+
cd quic-interop-runner
61+
pip install -U pip
62+
pip install -r requirements.txt
63+
shell: bash
64+
65+
- name: Run tests
66+
id: test-run
67+
run: |
68+
cd quic-interop-runner
69+
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
70+
cat implementations.json
71+
ARGS="--log-dir logs --must-include ${{ inputs.name }}"
72+
if [ -n "${{ inputs.client }}" ]; then
73+
ARGS="$ARGS --client ${{ inputs.client }}"
74+
fi
75+
if [ -n "${{ inputs.server }}" ]; then
76+
ARGS="$ARGS --server ${{ inputs.server }}"
77+
fi
78+
if [ -n "${{ inputs.test }}" ]; then
79+
ARGS="$ARGS --test ${{ inputs.test }}"
80+
fi
81+
python run.py $ARGS 2>&1 | tee summary
82+
shell: bash
83+
84+
- uses: actions/upload-artifact@v4
85+
id: artifact-upload-step
86+
if: always()
87+
with:
88+
name: logs
89+
path: quic-interop-runner/logs
90+
91+
# This action might be running off of a fork and would thus not have write
92+
# permissions on the origin repository. In order to allow a separate
93+
# priviledged action to post a comment on a pull request, upload the
94+
# necessary metadata.
95+
- name: store comment-data
96+
shell: bash
97+
if: github.event_name == 'pull_request'
98+
env:
99+
PULL_REQUEST_NUMBER: ${{ github.event.number }}
100+
run: |
101+
mkdir comment-data
102+
mv quic-interop-runner/summary comment-data/summary
103+
echo $PULL_REQUEST_NUMBER > comment-data/pr-number
104+
echo '${{ steps.artifact-upload-step.outputs.artifact-url }}' > comment-data/logs-url
105+
106+
- name: Upload comment data
107+
uses: actions/upload-artifact@v4
108+
if: github.event_name == 'pull_request'
109+
with:
110+
name: comment-data
111+
path: ./comment-data

.github/workflows/qns-comment.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Post test results as pull request comment.
2+
#
3+
# This is done as a separate workflow as it requires write permissions. The
4+
# tests itself might run off of a fork, i.e. an untrusted environment and should
5+
# thus not be granted write permissions.
6+
7+
name: Comment on the pull request
8+
9+
on:
10+
workflow_run:
11+
workflows: ["QUIC Network Simulator"]
12+
types:
13+
- completed
14+
15+
jobs:
16+
comment:
17+
permissions:
18+
pull-requests: write
19+
runs-on: ubuntu-latest
20+
if: >
21+
github.event.workflow_run.event == 'pull_request'
22+
steps:
23+
- name: Download comment-data
24+
uses: actions/download-artifact@v4
25+
with:
26+
run-id: ${{ github.event.workflow_run.id }}
27+
name: comment-data
28+
github-token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Format GitHub comment
31+
run: |
32+
pwd
33+
ls -la
34+
echo '[**QUIC Interop Runner**](https://github.com/quic-interop/quic-interop-runner)' >> comment
35+
echo '' >> comment
36+
echo '```' >> comment
37+
cat summary >> comment
38+
echo '```' >> comment
39+
echo '' >> comment
40+
echo 'Download artifacts [here](' >> comment
41+
cat logs-url >> comment
42+
echo ').' >> comment
43+
shell: bash
44+
45+
- name: Read PR Number
46+
id: pr-number
47+
run: echo "::set-output name=number::$(cat pr-number)"
48+
shell: bash
49+
50+
- name: Comment PR
51+
uses: thollander/actions-comment-pull-request@v2
52+
with:
53+
filePath: comment
54+
pr_number: ${{ steps.pr-number.outputs.number }}

.github/workflows/qns.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ on:
66
workflow_dispatch:
77
pull_request:
88
branches: ["main"]
9-
paths:
10-
- 'qns/**'
11-
- '.github/workflows/qns.yml'
129
merge_group:
10+
1311
jobs:
14-
docker-image:
12+
quic-network-simulator:
1513
runs-on: ubuntu-latest
1614
permissions:
1715
packages: write
@@ -44,6 +42,7 @@ jobs:
4442
type=raw,value=latest,enable={{is_default_branch}}
4543
4644
- name: Build and push
45+
id: docker_build_and_push
4746
uses: docker/build-push-action@v5
4847
with:
4948
push: ${{ github.event_name != 'pull_request' }}
@@ -53,4 +52,21 @@ jobs:
5352
RUST_VERSION=stable
5453
cache-from: type=gha
5554
cache-to: type=gha,mode=max
56-
platforms: linux/amd64, linux/arm64
55+
# On pull requests only build amd64 for the sake of CI time.
56+
platforms: ${{ github.event_name == 'pull_request' && 'linux/amd64' || 'linux/amd64, linux/arm64' }}
57+
load: ${{ github.event_name == 'pull_request' }}
58+
59+
- name: Checkout
60+
uses: actions/checkout@v4
61+
62+
- name: Run QUIC Interop tests
63+
if: ${{ github.event_name == 'pull_request' }}
64+
# TODO: Replace once https://github.com/quic-interop/quic-interop-runner/pull/356 is merged.
65+
uses: ./.github/actions/quic-interop-runner
66+
with:
67+
name: 'neqo-latest'
68+
image: ${{ steps.docker_build_and_push.outputs.imageID }}
69+
url: https://github.com/mozilla/neqo
70+
test: handshake
71+
client: neqo-latest,quic-go,ngtcp2,neqo,msquic
72+
server: neqo-latest,quic-go,ngtcp2,neqo,msquic

0 commit comments

Comments
 (0)