Skip to content

selftests: mptcp: userspace pm get addr tests #322

selftests: mptcp: userspace pm get addr tests

selftests: mptcp: userspace pm get addr tests #322

name: "MPTCP Upstream Build 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 build 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:
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']
permissions:
contents: read # to fetch code (actions/checkout)
steps:
- name: "Checkout (light)"
if: github.ref != 'refs/heads/export'
uses: actions/checkout@v3
with:
fetch-depth: 100 # we should not have more commits on top of export and -net
- name: "Checkout (export)"
if: github.ref == 'refs/heads/export'
uses: actions/checkout@v3
with:
fetch-depth: 0 # we need to fetch all commits between net and net-next, quicker to get everything
- name: "Find base branch"
id: branch
run: |
if [ "${REF_NAME}" = "export" ]; then # just to avoid the next cmd
echo "name=export" >> ${GITHUB_OUTPUT}
elif [ -n "$(git log -1 --grep "^DO-NOT-MERGE: mptcp: enabled by default (net)$" --format="format:%H" HEAD -- net/mptcp/Kconfig)" ]; then
echo "name=export-net" >> ${GITHUB_OUTPUT}
else
echo "name=export" >> ${GITHUB_OUTPUT}
fi
env:
REF_NAME: ${{ github.ref_name }}
- name: "Restore cache for CCache"
uses: actions/cache/restore@v3
id: restore-ccache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}_build_${{ matrix.defconfig }}_${{ matrix.ipv6 }}_${{ matrix.mptcp }}_${{ steps.branch.outputs.name }}-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}_build_${{ matrix.defconfig }}_${{ matrix.ipv6 }}_${{ matrix.mptcp }}_${{ steps.branch.outputs.name }}-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}
${{ runner.os }}_build_${{ matrix.defconfig }}_${{ matrix.ipv6 }}_${{ matrix.mptcp }}_${{ steps.branch.outputs.name }}-${{ github.run_id }}-${{ github.run_attempt }}-
${{ runner.os }}_build_${{ matrix.defconfig }}_${{ matrix.ipv6 }}_${{ matrix.mptcp }}_${{ steps.branch.outputs.name }}-${{ github.run_id }}-
${{ runner.os }}_build_${{ matrix.defconfig }}_${{ matrix.ipv6 }}_${{ matrix.mptcp }}_${{ steps.branch.outputs.name }}-
- 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 (or -net) except for stable
each_commit: ${{ ! startswith(github.ref, 'refs/heads/stable/') }}
ccache_maxsize: 600M ## 10/2^3/2=625: 10GB = project limit ; 2^3 = matrix ; 2: -net and net-next
defconfig: ${{ matrix.defconfig }}
ipv6: ${{ matrix.ipv6 }}
mptcp: ${{ matrix.mptcp }}
debug: ${{ secrets.BUILD_ACTION_DEBUG }}
- name: "Artifacts"
if: always()
uses: actions/upload-artifact@v3
with:
name: results
path: ./build-*-results.txt
- name: "Save cache for CCache"
if: github.ref == 'refs/heads/export' || github.ref == 'refs/heads/export-net'
uses: actions/cache/save@v3
with:
path: ${{ github.workspace }}/.ccache
key: ${{ steps.restore-ccache.outputs.cache-primary-key }}
notif:
name: "Notifications"
needs: build
# only for the official repo (patchew)
if: always() && github.repository_owner == 'multipath-tcp' && startswith(github.ref, 'refs/tags/patchew/')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: results
- name: "Patchwork"
run: |
# $1: mid
get_status() {
case "$(awk "/^${1} /{ print \$2 }" build-*-results.txt | sort -u)" in
'fail'*) echo "fail"; ;;
*'warning') echo "warning"; ;;
'success') echo "success"; ;;
*) echo "fail"; ;;
esac
}
# $1: mid, $2: status
get_desc() {
awk "/^${1} ${2} /{
out=\$3
for(i=4; i<=NF; i++)
out=out\" \"\$i
print out
}" build-*-results.txt | sort -u | sed '$!{:a;N;s/\n/ ; /;ta}'
}
# $1: mid, $2: status, $3: desc
_send() { local check_url
check_url="$(curl "${URL_PW}${1}" | jq -r 'last(.[].checks)')"
if [ -z "${check_url}" ] || [ "${check_url}" = "null" ]; then
echo "URL not found: '${check_url}' '${URL_PW}${1}'"
return 1
fi
curl ${CURL_OPT} \
-X POST \
-H "Authorization: Token ${{ secrets.PW_TOKEN }}" \
-F "state=${2}" \
-F "target_url=${URL_GH}" \
-F "context=build" \
-F "description=${3}" \
"${check_url}" | jq '.'
}
FIRST=1
send() { local i
# patches can take a bit of time to appear: retry the first time
if [ "${FIRST}" = "1" ]; then
FIRST=0
for i in $(seq 45); do
if _send "${@}"; then
echo "Successful sent after ${i} attempts"
return 0
fi
sleep 1m
done
curl "${URL_PW}${1}"
return 1
else
_send "${@}"
fi
}
if ! ls ./build-*-results.txt; then
echo "Strange, no results, please check why"
exit 1
fi
while read -r mid; do
status=$(get_status "${mid}")
desc=$(get_desc "${mid}" "${status}")
send "${mid}" "${status}" "${desc}"
done < <(awk '{ print $1 }' build-*-results.txt | sort -u)
env:
URL_GH: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
URL_PW: "${{ env.PW }}/patches/?project=mptcp&msgid="