From d062e34d793e9d74e887020cdde5523a20efc73d Mon Sep 17 00:00:00 2001 From: Carlos Garces Date: Sat, 6 Mar 2021 13:27:49 +0100 Subject: [PATCH] Improved github actions Added step to detect misuse of USB_VENDOR_ID_REALTEK Added check for duplicated USB IDs Check for .deb files before download it Move git checkout before build step --- .github/workflows/build.yml | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 332e2bb..75d9e4f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,40 +3,49 @@ name: Build on: [pull_request] jobs: - fetchKernelData: + + commontasks: runs-on: ubuntu-latest outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} steps: - - id: set-matrix + - uses: actions/checkout@v2 + - name: Avoid 0x0BDA + #Find devices that not use 0x0BDA instead of const USB_VENDOR_ID_REALTEK + run: grep -c -i "0x0BDA" os_dep/linux/usb_intf.c | grep -w 1 + - name: Find duplicates + #Find devices that not use 0x0BDA instead of const USB_VENDOR_ID_REALTEK + run: grep -i "{USB_DEVICE(" os_dep/linux/usb_intf.c | cut -d ')' -f1 | sort | uniq -cd | wc -c | grep -w 0 + - name: Get kernel matrix + id: set-matrix run: | - JSON=$(curl https://www.kernel.org/releases.json) + JSON=$(curl -s https://www.kernel.org/releases.json) VERSIONSARRAY=$(echo $JSON | jq -c '[.releases[] | {version: .version, moniker: .moniker} | select(.moniker != "linux-next") | .version]') echo ::set-output name=matrix::${VERSIONSARRAY} build: - needs: fetchKernelData + needs: commontasks runs-on: ubuntu-latest strategy: fail-fast: false matrix: - version: ${{fromJson(needs.fetchKernelData.outputs.matrix)}} + version: ${{fromJson(needs.commontasks.outputs.matrix)}} #version: [4.9.248, 4.4.248] steps: - - uses: actions/checkout@v2 - - name: download-Kernel + - name: install deb packages env: VERSION: ${{matrix.version }} run: | KERNEL_URL=https://kernel.ubuntu.com/~kernel-ppa/mainline/ KERNEL_URL_DETAILS=$(wget --quiet -O - ${KERNEL_URL}v${VERSION}/ | grep -A8 "Build for amd64\|Test amd64") ALL_DEB=$(echo "$KERNEL_URL_DETAILS" | grep -m1 'all.deb' | cut -d '"' -f 2) - KVER=$(echo $ALL_DEB | cut -d '_' -f 2 | rev | cut -c14- | rev)-generic - wget -nv ${KERNEL_URL}v${VERSION}/$(echo "$KERNEL_URL_DETAILS" | grep -m1 "amd64.deb" | cut -d '"' -f 2) + AMD64_DEB=$(echo "$KERNEL_URL_DETAILS" | grep -m1 "amd64.deb" | cut -d '"' -f 2) + [ -z "$ALL_DEB" ] && exit 1 + [ -z "$AMD64_DEB" ] && exit 2 + wget -nv ${KERNEL_URL}v${VERSION}/$AMD64_DEB wget -nv ${KERNEL_URL}v${VERSION}/$ALL_DEB sudo dpkg --force-all -i *.deb - sudo wget https://raw.githubusercontent.com/torvalds/linux/master/scripts/module.lds.S -O /usr/src/linux-headers-$KVER/scripts/module.lds - sudo sed -i '$ d' /usr/src/linux-headers-$KVER/scripts/module.lds - echo "KVER=$KVER" >> $GITHUB_ENV + echo "KVER=$(echo $ALL_DEB | cut -d '_' -f 2 | rev | cut -c14- | rev)-generic" >> $GITHUB_ENV + - uses: actions/checkout@v2 - name: build run: make KVER=$KVER