This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "MPTCP Upstream Tests Validation" | |
on: | |
push: | |
branches-ignore: | |
- 'archived/**' # previous branches | |
- 't/**' # TopGit tree | |
- 'net' # part of the TopGit tree | |
- 'net-next' # part of the TopGit tree | |
- 'for-review' # part of the TopGit tree | |
- 'for-review-net' # part of the TopGit tree | |
tags: | |
- 'patchew/**' # patchew is using tags | |
# ideally, we would take 'export/**' but the cache is per branch... | |
# In other words, when using tags, we can only use the cache if we re-tag. | |
# https://github.com/actions/cache/issues/556 | |
# So we test the "export" branch and we try to find the tag later | |
env: | |
CURL_OPT: "--no-progress-meter --connect-timeout 30 --retry 20 --retry-delay 10" | |
PW: "https://patchwork.kernel.org/api/1.2" | |
permissions: {} | |
jobs: | |
tests: | |
name: "Tests" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
mode: ['normal'] # TODO ['normal', 'btf', 'debug'] | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
checks: write # to write results | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
#- name: "Collect Workflow Telemetry" | |
# uses: catchpoint/workflow-telemetry-action@v2 | |
- name: "Find base branch" | |
id: branch | |
run: | | |
if [ "$(cat .git_markup)" = "MPTCP-related modifications only needed for our tests suite (mptcp-net)." ]; then | |
echo "name=export-net" >> ${GITHUB_OUTPUT} | |
else | |
echo "name=export" >> ${GITHUB_OUTPUT} | |
fi | |
- name: "Restore cache for CCache" | |
uses: actions/cache/restore@v4 | |
id: restore-ccache | |
with: | |
path: ${{ github.workspace }}/.virtme/ccache | |
key: ${{ runner.os }}_tests_${{ steps.branch.outputs.name }}-${{ matrix.mode }}-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}_tests_${{ steps.branch.outputs.name }}-${{ matrix.mode }}-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }} | |
${{ runner.os }}_tests_${{ steps.branch.outputs.name }}-${{ matrix.mode }}-${{ github.run_id }}-${{ github.run_attempt }}- | |
${{ runner.os }}_tests_${{ steps.branch.outputs.name }}-${{ matrix.mode }}-${{ github.run_id }}- | |
${{ runner.os }}_tests_${{ steps.branch.outputs.name }}-${{ matrix.mode }}- | |
${{ runner.os }}_tests_${{ steps.branch.outputs.name }}- | |
- name: "Tests" | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
/usr/bin/docker run --workdir /github/workspace --rm \ | |
--privileged --pull always \ | |
-e "INPUT_CCACHE_MAXSIZE=500M" \ | |
-e "INPUT_MODE=auto-${{ matrix.mode }}" \ | |
-e "INPUT_PACKETDRILL_STABLE=${{ steps.branch.outputs.name == 'export-net' && '1' || '0' }}" \ | |
-e "INPUT_EXTRA_ENV=${{ matrix.mode == 'btf' && 'INPUT_RUN_TESTS_ONLY=bpftest_all' || '' }}" \ | |
-e "INPUT_TRACE=${{ secrets.TESTS_ACTION_DEBUG }}" \ | |
-e "INPUT_CI_TIMEOUT_SEC" \ | |
-e "GITHUB_SHA" -e "GITHUB_REF_NAME" -e GITHUB_ACTIONS=true -e CI=true \ | |
-v "${PWD}":"/github/workspace" \ | |
mptcp/mptcp-upstream-virtme-docker:${{ steps.branch.outputs.name == 'export' && 'latest' || 'net' }} | |
- name: "Publish conclusion" | |
if: always() | |
run: | | |
if [ -s "conclusion.txt" ]; then | |
{ | |
echo '## Mode ${{ matrix.mode }}' | |
echo '### Conclusion (${{ matrix.mode }})' | |
cat "conclusion.txt" | |
echo '' | |
echo '### Summary (${{ matrix.mode }})' | |
echo '```' | |
cat "summary.txt" | |
echo '```' | |
} >> "${GITHUB_STEP_SUMMARY}" | |
fi | |
- name: "Artifacts (always)" | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: results-${{ matrix.mode }} | |
path: | | |
conclusion.txt | |
summary.txt | |
*.tap | |
config.zstd | |
*.tap.xml | |
- name: "Artifacts (failure)" | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debug-info-${{ matrix.mode }} | |
path: | | |
vmlinux.zstd | |
kmemleak.txt | |
- name: "Publish Test Results" | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: | | |
*.tap.xml | |
- name: "Save cache for CCache" | |
if: always() && (github.repository_owner != 'multipath-tcp' || (github.ref_name == 'export' || github.ref_name == 'export-net')) | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ github.workspace }}/.virtme/ccache | |
key: ${{ steps.restore-ccache.outputs.cache-primary-key }} | |
notif: | |
name: "Notifications" | |
needs: tests | |
# only for the official repo (patchew) | |
if: always() && github.repository_owner == 'multipath-tcp' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: results-* | |
merge-multiple: false | |
- name: get test info | |
id: test | |
run: | | |
for mode in normal btf debug; do | |
ccl="$(cat "results-${mode}/conclusion.txt")" | |
echo "ccl_${mode}=${ccl}" >> ${GITHUB_OUTPUT} | |
echo "ccl_title_${mode}=$(echo "${ccl}" | cut -d: -f1-2)" >> ${GITHUB_OUTPUT} | |
echo "ccl_status_${mode}=$(echo "${ccl}" | cut -d: -f3- | sed 's/^ //')" >> ${GITHUB_OUTPUT} | |
done | |
echo "url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> ${GITHUB_OUTPUT} | |
- name: irc tests | |
if: github.ref_name == 'export' || github.ref_name == 'export-net' | |
uses: rectalogic/notify-irc@v2 | |
with: | |
server: irc.libera.chat | |
channel: "#mptcp-ci" | |
nickname: gh-tests-bot | |
verbose: true | |
message: |- | |
New GH Actions Tests job validating ${{ github.ref_name }} (by ${{ github.actor }}) just ended: ${{ steps.test.outputs.url }} | |
- ${{ steps.test.outputs.ccl_normal }} | |
- ${{ steps.test.outputs.ccl_btf }} | |
- ${{ steps.test.outputs.ccl_debug }} | |
- name: get commit info | |
id: commit | |
if: startswith(github.ref, 'refs/tags/patchew/') | |
run: | | |
cat <<'EOF' > commit.json | |
${{ toJSON(github.event.head_commit) }} | |
EOF | |
# ignore error, just in case the MID has not been added by the author | |
read -r TAG MID < <(jq -r '.message' commit.json | grep "^Message-Id: " | tail -n1) || true | |
echo "Found message ID: '${TAG}' '${MID}'" | |
echo "mid=${MID:1:-1}" >> ${GITHUB_OUTPUT} | |
# TODO: reply to the cover-letter: query lore. | |
SUBJECT=$(jq -r '.message' commit.json | head -n1) | |
echo "Found subject: '${SUBJECT}'" | |
echo "subject=${SUBJECT}" >> ${GITHUB_OUTPUT} | |
NAME=$(jq -r '.author.name' commit.json) | |
EMAIL=$(jq -r '.author.email' commit.json) | |
echo "Found author: '${NAME}' '${EMAIL}'" | |
echo "name=${NAME%% *}" >> ${GITHUB_OUTPUT} | |
echo "author=${NAME} <${EMAIL}>" >> ${GITHUB_OUTPUT} | |
SHA=$(jq -r '.id' commit.json) | |
echo "Found SHA: '${SHA}' ('${SHA:0:12}')" | |
echo "sha=${SHA:0:12}" >> ${GITHUB_OUTPUT} | |
COMMITTER=$(jq -r '.committer.name' commit.json) | |
echo "Found committer: '${COMMITTER}'" | |
echo "committer=${COMMITTER}" >> ${GITHUB_OUTPUT} | |
- name: send email | |
if: startswith(github.ref, 'refs/tags/patchew/') | |
uses: dawidd6/action-send-mail@v3 | |
with: | |
server_address: smtp.gmail.com | |
server_port: 465 | |
username: ${{ secrets.MAIL_USERNAME }} | |
password: ${{ secrets.MAIL_PASSWORD }} | |
to: ${{ steps.commit.outputs.author }} | |
cc: mptcp@lists.linux.dev | |
from: MPTCP CI | |
reply_to: mptcp@lists.linux.dev | |
in_reply_to: "<${{ steps.commit.outputs.mid }}>" | |
subject: "Re: ${{ steps.commit.outputs.subject }}: Tests Results" | |
body: | | |
Hi ${{ steps.commit.outputs.name }}, | |
Thank you for your modifications, that's great! | |
Our CI (GitHub Action) did some validations and here is its report: | |
- ${{ steps.test.outputs.ccl_title_normal }}: ${{ steps.test.outputs.ccl_status_normal }} | |
- ${{ steps.test.outputs.ccl_title_btf }}: ${{ steps.test.outputs.ccl_status_btf }} | |
- ${{ steps.test.outputs.ccl_title_debug }}: ${{ steps.test.outputs.ccl_status_debug }} | |
- Task: ${{ steps.test.outputs.url }} | |
Initiator: ${{ steps.commit.outputs.committer }} | |
Commits: ${{ github.server_url }}/${{ github.repository }}/commits/${{ steps.commit.outputs.sha }} | |
If there are some issues, you can reproduce them using the same environment as | |
the one used by the CI thanks to a docker image, e.g.: | |
$ cd [kernel source code] | |
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \ | |
--pull always mptcp/mptcp-upstream-virtme-docker:latest \ | |
auto-normal | |
For more details: | |
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker | |
Please note that despite all the efforts that have been already done to have a | |
stable tests suite when executed on a public CI like here, it is possible some | |
reported issues are not due to your modifications. Still, do not hesitate to | |
help us improve that ;-) | |
Cheers, | |
MPTCP GH Action bot | |
Bot operated by Matthieu Baerts (NGI0 Core) | |
- name: set patchwork check | |
if: startswith(github.ref, 'refs/tags/patchew/') | |
run: | | |
CHECK_URLS=() | |
set_url() { local series_url | |
series_url=$(curl ${CURL_OPT} "${URL}" | jq -r 'last(last(.[].series)[].url)') | |
if [ -z "${series_url}" ] || [ "${series_url}" = "null" ]; then | |
echo "Series not found: '${series_url}' '${URL}'" | |
return 1 | |
fi | |
echo "Found Series: '${series_url}'" | |
readarray -t CHECK_URLS < <(curl ${CURL_OPT} "${series_url}" | jq -r '.patches[].url + "checks/"') | |
} | |
# $1: title, $2: status, $3: url | |
submit() { local check_url | |
if [[ "${2}" == "Success"* ]]; then | |
STATE="success" | |
elif [[ "${2}" == "Unstable"* ]]; then | |
STATE="warning" | |
else | |
STATE="fail" | |
fi | |
for check_url in "${CHECK_URLS[@]}"; do | |
curl ${CURL_OPT} \ | |
-X POST \ | |
-H "Authorization: Token ${{ secrets.PW_TOKEN }}" \ | |
-F "state=${STATE}" \ | |
-F "target_url=${3}" \ | |
-F "context=${1//[ :()]/_}" \ | |
-F "description=${2}" \ | |
"${check_url}" | jq '.' | |
done | |
} | |
for i in $(seq 30); do # patches can take a bit of time to appear | |
set_url && break | |
sleep 1m | |
done | |
if [ "${#CHECK_URLS[@]}" -eq 0 ]; then | |
echo "Error: didn't find any URLs after ${i} attempts" | |
exit 1 | |
fi | |
echo "Found: ${#CHECK_URLS[@]} urls after ${i} attempts: ${CHECK_URLS[@]}" | |
submit "${{ steps.test.outputs.ccl_title_normal }}" "${{ steps.test.outputs.ccl_status_normal }}" "${{ steps.test.outputs.url }}" | |
submit "${{ steps.test.outputs.ccl_title_btf }}" "${{ steps.test.outputs.ccl_status_btf }}" "${{ steps.test.outputs.url }}" | |
submit "${{ steps.test.outputs.ccl_title_debug }}" "${{ steps.test.outputs.ccl_status_debug }}" "${{ steps.test.outputs.url }}" | |
env: | |
URL: "${{ env.PW }}/patches/?project=mptcp&msgid=${{ steps.commit.outputs.mid }}" |