ci: Add a workflow to check Wi-Fi FW patch version #8
Workflow file for this run
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: Verify nRF70 Wi-Fi firmware patch version | |
on: pull_request | |
env: | |
PATCH_INFO_FILE: 'nrf_wifi/fw_if/umac_if/inc/fw/patch_info.h' | |
PATCH_BIN_BASE: 'nrf_wifi/fw_bins' | |
COMMENT: 'nRF70 Wi-Fi firmware patch version:' | |
PATCH_BIN_VER_OFFSET: 8 | |
jobs: | |
verify: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Extract patch version | |
run: | | |
echo EXP_PATCH_VERSION=$(cat ${{ env.PATCH_INFO_FILE }} | grep "#define RPU_" | awk '{print $3}' | tr -d '()' | paste -sd ".") >> "$GITHUB_OUTPUT" | |
id: patch_version | |
- name: Verify patch version | |
run: | | |
for patch in $(find ${{ env.PATCH_BIN_BASE }} -name 'nrf70.bin'); do | |
echo "Verifying $patch" | |
patch_version=$(hexdump -s ${{PATCH_BIN_VER_OFFSET}} -n 4 -e '16/1 "%x " "\n"' $patch | tr -d ' ' | rev | sed 's/.\{1\}/&./g' | sed 's/.$//') | |
echo "Patch version: $patch_version, expected: ${{ steps.patch_version.outputs.EXP_PATCH_VERSION }}" | |
if [ "${{ steps.patch_version.outputs.EXP_PATCH_VERSION }}" != "$patch_version" ]; then | |
echo "Patch version mismatch for $patch: $patch_version != ${{ steps.patch_version.outputs.EXP_PATCH_VERSION }}" >> "$COMMENT" | |
exit 1 | |
else | |
echo "Patch version verified for $patch" >> "$COMMENT" | |
fi | |
done | |
- debug: | |
with: | |
env: COMMENT | |
- name: Comment on PR | |
if: ${{ always() }} | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: ${{ env.COMMENT }} | |
}) |