-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AyabAsync v1.1.1 #212
AyabAsync v1.1.1 #212
Conversation
Upload artifact from ayabAsync
- Use env variable for FW version - Test FW presence - Errors handling
Upload artifact from ayabAsync
WalkthroughThe pull request introduces modifications to the Changes
Warning Tool Failures:Tool Failure Count:Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/archive_build.yml
(1 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/archive_build.yml
12-12: shellcheck reported issue in this script: SC2086:info:2:20: Double quote to prevent globbing and word splitting
(shellcheck)
12-12: shellcheck reported issue in this script: SC2086:info:6:6: Double quote to prevent globbing and word splitting
(shellcheck)
20-20: shellcheck reported issue in this script: SC2144:error:1:11: -f doesn't work with globs. Use a for loop
(shellcheck)
🪛 yamllint
.github/workflows/archive_build.yml
[warning] 11-11: too many spaces before colon
(colons)
🔇 Additional comments (1)
.github/workflows/archive_build.yml (1)
25-29
: LGTM!
The artifact archiving configuration is correct and uses a pinned version of the action.
env: | ||
AYAB_VERSION: v1.1.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Version mismatch and hardcoding concern
The hardcoded version v1.1.1
doesn't match the PR title's version v1.1.0
. Additionally, hardcoding the version makes future updates more error-prone.
Consider:
- First, verify which version is correct
- Then, consider making the version configurable through workflow inputs:
name: Archive Build
-on: [push, pull_request]
+on:
+ push:
+ pull_request:
+ workflow_dispatch:
+ inputs:
+ version:
+ description: 'AYAB firmware version'
+ required: true
+ default: 'v1.1.1'
env:
- AYAB_VERSION: v1.1.1
+ AYAB_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || 'v1.1.1' }}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
env: | |
AYAB_VERSION: v1.1.1 | |
name: Archive Build | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'AYAB firmware version' | |
required: true | |
default: 'v1.1.1' | |
env: | |
AYAB_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || 'v1.1.1' }} |
- name: Verify hex file presence | ||
run: | | ||
if [ ! -f ./*.hex ]; then | ||
echo "Error: No hex file found" | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Fix hex file verification
The current glob usage with -f
is incorrect and could lead to false positives.
Apply this improvement:
- name: Verify hex file presence
run: |
- if [ ! -f ./*.hex ]; then
- echo "Error: No hex file found"
+ hex_files=( *.hex )
+ if [ ${#hex_files[@]} -eq 0 ] || [ ! -f "${hex_files[0]}" ]; then
+ echo "Error: No hex files found in $(pwd)"
exit 1
fi
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
- name: Verify hex file presence | |
run: | | |
if [ ! -f ./*.hex ]; then | |
echo "Error: No hex file found" | |
exit 1 | |
fi | |
- name: Verify hex file presence | |
run: | | |
hex_files=( *.hex ) | |
if [ ${#hex_files[@]} -eq 0 ] || [ ! -f "${hex_files[0]}" ]; then | |
echo "Error: No hex files found in $(pwd)" | |
exit 1 | |
fi |
🧰 Tools
🪛 actionlint
20-20: shellcheck reported issue in this script: SC2144:error:1:11: -f doesn't work with globs. Use a for loop
(shellcheck)
- name: Fetch binary | ||
env: | ||
firmwareUrl : https://github.com/jpcornil-git/ayabAsync-firmware/releases/download/${{ env.AYAB_VERSION }}/firmware_uno_1_1_1.hex | ||
run: | | ||
set -e | ||
if ! wget --spider ${firmwareUrl}; then | ||
echo "Error: Firmware file not found" | ||
exit 1 | ||
fi | ||
wget ${firmwareUrl} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
🛠️ Refactor suggestion
Using unofficial firmware source poses potential risks
The current workflow downloads firmware from jpcornil-git/ayabAsync-firmware
, which is a fork with recent releases (latest v1.1.1 from 2024-11-08). However, this is not the official AYAB firmware repository. The official repository exists at AllYarnsAreBeautiful/ayab-firmware
, and according to the documentation, it is the authoritative source for AYAB firmware.
Using an unofficial fork:
- Bypasses the community review process
- May introduce unauthorized modifications
- Creates security and maintenance risks
Recommend switching to the official repository at AllYarnsAreBeautiful/ayab-firmware
for firmware downloads.
The shell script improvements in the original review are still valid and should be applied regardless of the repository source.
🔗 Analysis chain
Security concern: Firmware source repository
The firmware is being downloaded from a personal fork (jpcornil-git/ayabAsync-firmware
) instead of the official AYAB repository.
Shell script improvements needed
The script has potential issues with word splitting and error messages.
Apply these improvements:
- name: Fetch binary
env:
- firmwareUrl : https://github.com/jpcornil-git/ayabAsync-firmware/releases/download/${{ env.AYAB_VERSION }}/firmware_uno_1_1_1.hex
+ FIRMWARE_URL: "https://github.com/AllYarnsAreBeautiful/ayab-firmware/releases/download/${{ env.AYAB_VERSION }}/firmware_uno_1_1_1.hex"
run: |
set -e
- if ! wget --spider ${firmwareUrl}; then
- echo "Error: Firmware file not found"
+ if ! wget --spider "${FIRMWARE_URL}"; then
+ echo "Error: Firmware file not found at ${FIRMWARE_URL}"
exit 1
fi
- wget ${firmwareUrl}
+ wget "${FIRMWARE_URL}"
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify if the official AYAB repository exists and contains firmware releases
gh repo view AllYarnsAreBeautiful/ayab-firmware >/dev/null 2>&1 && \
echo "Official repo exists" && \
gh release view v1.1.1 --repo AllYarnsAreBeautiful/ayab-firmware 2>/dev/null
Length of output: 167
Script:
#!/bin/bash
# Check if the fork repository exists and contains the firmware
gh repo view jpcornil-git/ayabAsync-firmware >/dev/null 2>&1 && \
echo "Fork repo exists" && \
gh release list --repo jpcornil-git/ayabAsync-firmware --limit 5
# Check if there are any discussions or references about this fork in the repository
rg -i "jpcornil-git|ayabasync" -g "!{.git,node_modules}/*"
# Look for any documentation about firmware sources
fd "README|CONTRIBUTING|FIRMWARE" -e md -X cat {}
Length of output: 5213
🧰 Tools
🪛 actionlint
12-12: shellcheck reported issue in this script: SC2086:info:2:20: Double quote to prevent globbing and word splitting
(shellcheck)
12-12: shellcheck reported issue in this script: SC2086:info:6:6: Double quote to prevent globbing and word splitting
(shellcheck)
🪛 yamllint
[warning] 11-11: too many spaces before colon
(colons)
Add AyabAsync v1.1.1 uno firmware to webtool to ease testing by others
More information about firmware changes/features is available here:
https://github.com/jpcornil-git/ayabAsync-firmware/releases/tag/v1.1.1
Firmware binaries for atmega2560 and uno R4 are also available from the link above
Summary by CodeRabbit
New Features
Bug Fixes
.hex
files, ensuring better reliability during the build process.Chores