Skip to content

Commit

Permalink
DO-NOT-MERGE: mptcp: add CI support
Browse files Browse the repository at this point in the history
Currently supported:

- Github Actions:
  - build-validation: check different combinations of validation
  - IRC: send notifications to the IRC channel
  - Update TopGit tree: sync with net-next and then override the export
    branch.

- Cirrus:
  - Run tests in a KVM: selftests, kunit, packetdrill, etc.

Signed-off-by: Matthieu Baerts <[email protected]>
  • Loading branch information
matttbe committed Oct 13, 2021
1 parent 45520da commit 1cc4e10
Show file tree
Hide file tree
Showing 4 changed files with 291 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

# Launch 2 jobs in //: with and without debug
task:
name: KVM validation
only_if: $CIRRUS_TAG != '' ## only tags

container:
image: mptcp/mptcp-upstream-virtme-docker
kvm: true ## Needed for the tests
cpu: 4 ## Max 16 per project, even number with kvm
memory: 4G ## Max 4 per CPU

env:
CIRRUS_CLONE_DEPTH: 1 ## no need to have a full clone
CIRRUS_LOG_TIMESTAMP: true ## useful
INPUT_CCACHE_MAXSIZE: 1G
matrix:
MATRIX_JOB: normal
MATRIX_JOB: debug

ccache_cache:
folder: ".virtme/ccache"
reupload_on_changes: true
fingerprint_script:
- echo ${MATRIX_JOB}

test_script: /entrypoint.sh expect-${MATRIX_JOB}

on_failure:
vmlinux_artifacts:
path: "vmlinux.zstd"

always:
conclusion_artifacts:
path: "conclusion.txt"
type: text/plain
summary_artifacts:
path: "summary.txt"
type: text/plain
tap_result_artifacts:
path: "*.tap"
type: text/plain
# JUnit format is for the moment only useful for PR but publish them just in case for later
junit_artifacts:
path: "*.tap.xml"
type: text/xml
format: junit
43 changes: 43 additions & 0 deletions .github/workflows/build-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "MPTCP Upstream Build Validation"
on:
push:
branches-ignore:
- 'archived/**' # previous branches
- 't/**' # TopGit tree
- 'net-next' # part of the TopGit tree
- 'for-review' # part of the TopGit tree
- 'export' # part of the TopGit tree
tags:
- 'export/**' # the CI create a new tag once there is a new export
- 'patchew/**' # patchew is using tags

jobs:
build:
name: "Build (matrix)"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
defconfig: ['x86_64', 'i386']
ipv6: ['with_ipv6', 'without_ipv6']
mptcp: ['with_mptcp', 'without_mptcp']
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 100 # we should not have more commits on top of net-next/export
- name: "Setup cache for CCache"
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-build-${{ matrix.defconfig }}-${{ matrix.ipv6 }}-${{ matrix.mptcp }}-${{ github.run_id }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-${{ matrix.defconfig }}-${{ matrix.ipv6 }}-${{ matrix.mptcp }}-
- name: "Build Validation"
uses: multipath-tcp/mptcp-upstream-validate-export-action@main
with:
# we want to validate each commits on top of net-next/export except for stable
each_commit: ${{ ! startswith(github.ref, 'refs/heads/stable/') }}
ccache_maxsize: 620M ## 5/2^3=625: 5GB = project limit ; 2^3 = matrix
defconfig: ${{ matrix.defconfig }}
ipv6: ${{ matrix.ipv6 }}
mptcp: ${{ matrix.mptcp }}
169 changes: 169 additions & 0 deletions .github/workflows/irc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
name: "IRC Notifications"
on:
push:
tags:
- 'export/**' # exclude patchew/** tags and branches
issues:
types: [opened, reopened, closed, assigned, unassigned]
workflow_run:
workflows: ["MPTCP Upstream Build Validation", "Update TopGit tree"]
types:
- completed
check_suite:
types:
- completed

jobs:
irc-tag:
name: "IRC Tag"
if: github.repository_owner == 'multipath-tcp' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: tag shortner
id: tag
run: |
echo "::set-output name=tag::${REF:10}"
env:
REF: ${{ github.event.ref }}
- name: irc tag
uses: rectalogic/notify-irc@v1
with:
server: irc.libera.chat
channel: "#mptcp-ci"
nickname: gh-tag-bot
message: "New tag available: ${{ steps.tag.outputs.tag }} (by ${{ github.actor }})"

irc-issues:
name: "IRC Issues"
if: github.repository_owner == 'multipath-tcp' && github.event_name == 'issues'
runs-on: ubuntu-latest
steps:
- name: issue info
id: info
if: github.event.action != 'opened'
run: |
echo "::set-output name=opener::, opened by ${OPENER}"
echo "::set-output name=assignee::${ASSIGNEE:+ and assigned to ${ASSIGNEE}}"
env:
OPENER: ${{ github.event.issue.user.login }}
ASSIGNEE: ${{ github.event.assignee.login }}
- name: irc issues
uses: rectalogic/notify-irc@v1
with:
server: irc.libera.chat
channel: "#mptcp"
nickname: gh-issues-bot
message: |-
Issue #${{ github.event.issue.number }} ("${{ github.event.issue.title }}"${{ steps.info.outputs.opener }}${{ steps.info.outputs.assignee }}) has been ${{ github.event.action }} by ${{ github.actor }}
${{ github.event.issue.html_url }}
irc-build:
name: "IRC Build"
if: github.repository_owner == 'multipath-tcp' && github.event_name == 'workflow_run' && github.event.workflow_run.name == 'MPTCP Upstream Build Validation' && startsWith(github.event.workflow_run.head_branch, 'export/')
runs-on: ubuntu-latest
steps:
- name: irc build
uses: rectalogic/notify-irc@v1
with:
server: irc.libera.chat
channel: "#mptcp-ci"
nickname: gh-build-bot
message: |-
New build validating ${{ github.event.workflow_run.head_branch }} (by ${{ github.actor }}) ended with ${{ github.event.workflow_run.conclusion }}
${{ github.event.workflow_run.html_url }}
irc-build-error:
name: "IRC Build Error"
if: github.repository_owner == 'multipath-tcp' && github.event_name == 'workflow_run' && github.event.workflow_run.name == 'MPTCP Upstream Build Validation' && startsWith(github.event.workflow_run.head_branch, 'export/') && github.event.workflow_run.conclusion != 'success'
runs-on: ubuntu-latest
steps:
- name: irc build
uses: rectalogic/notify-irc@v1
with:
server: irc.libera.chat
channel: "#mptcp"
nickname: gh-build-bot
message: |-
New build validating ${{ github.event.workflow_run.head_branch }} (by ${{ github.actor }}) failed: ${{ github.event.workflow_run.conclusion }}
${{ github.event.workflow_run.html_url }}
irc-topgit:
name: "IRC TopGit"
if: github.repository_owner == 'multipath-tcp' && github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Update TopGit tree' && github.event.workflow_run.conclusion != 'success'
runs-on: ubuntu-latest
steps:
- name: irc topgit
uses: rectalogic/notify-irc@v1
with:
server: irc.libera.chat
channel: "#mptcp"
nickname: gh-topgit-bot
message: |-
New sync with latest net-next failed (initiated by ${{ github.actor }}): ${{ github.event.workflow_run.conclusion }}
${{ github.event.workflow_run.html_url }}
irc-tests:
name: "IRC Tests"
if: github.repository_owner == 'multipath-tcp' && github.event_name == 'check_suite' && github.event.check_suite.app.name == 'Cirrus CI' && github.event.check_suite.conclusion != 'neutral'
runs-on: ubuntu-latest
env:
ACCEPT: "Accept: application/vnd.github.v3+json"
URI: "https://api.github.com"
steps:
- name: get linked tag
id: tag
run: |
TAG=$(curl -H "${ACCEPT}" "${URL}" | jq -r ".[] | select(.object.sha == \"${SHA}\").ref" | tail -n1)
echo "Found: ${TAG}"
echo "::set-output name=tag::${TAG:10}"
env:
URL: "${{ env.URI }}/repos/${{ github.repository }}/git/matching-refs/tags/"
SHA: "${{ github.event.check_suite.head_sha }}"

# inspired by: https://cirrus-ci.org/guide/notifications/
- name: get cirrus status
if: startsWith(steps.tag.outputs.tag, 'export/')
id: cirrus
run: |
curl -H "${ACCEPT}" "${URL}" > check-runs.json
jq -r '.check_runs[] | select(.conclusion != "neutral")' check-runs.json > check-runs_strip.json
i=0
for id in $(jq -r '.external_id' check-runs_strip.json); do
echo "${i}: Found ID: ${id}"
ccl_url="https://api.cirrus-ci.com/v1/artifact/task/${id}/conclusion/conclusion.txt"
echo -n "::set-output name=ccl_${i}::"
echo "$(curl -q "${ccl_url}" || echo "${i}: Unable to get the conclusion")"
i=$((i+1))
done
i=0
for url in $(jq -r '.details_url' check-runs_strip.json); do
echo "${i}: URL: ${url}"
echo "::set-output name=url_${i}::${url}"
i=$((i+1))
done
# extra debug if nothing was found
if [ ${i} -eq 0 ]; then
jq '.' check-runs.json
jq '.' check-runs_strip.json
fi
env:
URL: "${{ env.URI }}/repos/${{ github.repository }}/check-suites/${{ github.event.check_suite.id }}/check-runs?status=completed"

- name: irc tests
if: startsWith(steps.tag.outputs.tag, 'export/')
uses: rectalogic/notify-irc@v1
with:
server: irc.libera.chat
channel: "#mptcp-ci"
nickname: gh-tests-bot
message: |-
New Tests job validating ${{ steps.tag.outputs.tag }} (by ${{ github.actor }}) just ended:
- ${{ steps.cirrus.outputs.ccl_0 }}: ${{ steps.cirrus.outputs.url_0 }}
- ${{ steps.cirrus.outputs.ccl_1 }}: ${{ steps.cirrus.outputs.url_1 }}
32 changes: 32 additions & 0 deletions .github/workflows/update-tg-tree.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Update TopGit tree"

on:
workflow_dispatch:
inputs:
keep_base_untouched:
description: 'Set it to 1 to force a sync without updating the base from upstream'
required: true
default: '0'
force_sync:
description: 'Set it to 1 to force a sync even if net-next is not updated'
required: true
default: '0'

schedule:
- cron: '33 5 * * *' # in UTC: after US West coast's work day

jobs:
export:
if: github.repository_owner == 'multipath-tcp'
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 0 # we need all commits for TopGit
token: '${{ secrets.PAT_JENKINS_TESSARES }}'
- name: "Update TG tree"
uses: multipath-tcp/mptcp-upstream-topgit-action@main
with:
not_base: "${{ github.event.inputs.keep_base_untouched || '0' }}"
force_sync: "${{ github.event.inputs.force_sync || '0' }}"

0 comments on commit 1cc4e10

Please sign in to comment.