Skip to content

Commit 68a86b2

Browse files
committed
Merge branch 'ci/fixes'
2 parents a7ef097 + c610fe8 commit 68a86b2

File tree

9 files changed

+65
-61
lines changed

9 files changed

+65
-61
lines changed

.github/scripts/tests_run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function run_test {
7878

7979
printf "\033[95mRunning test: %s -- Config: %s\033[0m\n" "$sketchname" "$fqbn"
8080
if [ "$erase_flash" -eq 1 ]; then
81-
esptool.py -c "$target" erase_flash
81+
esptool -c "$target" erase-flash
8282
fi
8383

8484
if [ "$len" -ne 1 ]; then

.github/workflows/tests_hw_wokwi.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ jobs:
7474
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
7575
id: set-ref
7676
run: |
77+
# Get info and sanitize it to avoid security issues
78+
7779
pr_num=$(jq -r '.pull_request.number' artifacts/event_file/event.json | tr -cd "[:digit:]")
7880
if [ -z "$pr_num" ] || [ "$pr_num" == "null" ]; then
7981
pr_num=""
@@ -145,6 +147,9 @@ jobs:
145147
echo "push_time = $push_time"
146148
147149
conclusion="${{ github.event.workflow_run.conclusion }}"
150+
run_id="${{ github.event.workflow_run.id }}"
151+
event="${{ github.event.workflow_run.event }}"
152+
sha="${{ github.event.workflow_run.head_sha || github.sha }}"
148153
149154
# Create a single JSON file with all workflow run information
150155
cat > artifacts/workflow_info.json <<EOF
@@ -159,19 +164,19 @@ jobs:
159164
"qemu_targets": $qemu_targets,
160165
"qemu_types": $qemu_types,
161166
"ref": "$ref",
162-
"event": "${{ github.event.workflow_run.event }}",
163-
"sha": "${{ github.event.workflow_run.head_sha || github.sha }}",
167+
"event": "$event",
168+
"sha": "$sha",
164169
"action": "$action",
165-
"run_id": "${{ github.event.workflow_run.id }}",
170+
"run_id": "$run_id",
166171
"conclusion": "$conclusion"
167172
}
168173
EOF
169174
170175
echo "Ref = $ref"
171-
echo "Event name = ${{ github.event.workflow_run.event }}"
172-
echo "Head SHA = ${{ github.event.workflow_run.head_sha || github.sha }}"
176+
echo "Event name = $event"
177+
echo "Head SHA = $sha"
173178
echo "Action = $action"
174-
echo "Run ID = ${{ github.event.workflow_run.id }}"
179+
echo "Run ID = $run_id"
175180
echo "Conclusion = $conclusion"
176181
177182
if [ -z "$ref" ] || [ "$ref" == "null" ]; then

.github/workflows/tests_results.yml

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040
- name: Get original info
4141
id: get-info
4242
run: |
43+
# Inputs in workflow_info.json are already sanitized and safe to use
44+
4345
original_event=$(jq -r '.event' ./artifacts/parent-artifacts/workflow_info.json)
4446
original_action=$(jq -r '.action' ./artifacts/parent-artifacts/workflow_info.json)
4547
original_sha=$(jq -r '.sha' ./artifacts/parent-artifacts/workflow_info.json)
@@ -48,44 +50,24 @@ jobs:
4850
original_run_id=$(jq -r '.run_id' ./artifacts/parent-artifacts/workflow_info.json)
4951
5052
hw_tests_enabled=$(jq -r '.hw_tests_enabled' ./artifacts/parent-artifacts/workflow_info.json)
51-
hw_targets=$(jq -r '.hw_targets' ./artifacts/parent-artifacts/workflow_info.json)
52-
hw_types=$(jq -r '.hw_types' ./artifacts/parent-artifacts/workflow_info.json)
53+
hw_targets=$(jq -c '.hw_targets' ./artifacts/parent-artifacts/workflow_info.json)
54+
hw_types=$(jq -c '.hw_types' ./artifacts/parent-artifacts/workflow_info.json)
5355
wokwi_tests_enabled=$(jq -r '.wokwi_tests_enabled' ./artifacts/parent-artifacts/workflow_info.json)
54-
wokwi_targets=$(jq -r '.wokwi_targets' ./artifacts/parent-artifacts/workflow_info.json)
55-
wokwi_types=$(jq -r '.wokwi_types' ./artifacts/parent-artifacts/workflow_info.json)
56+
wokwi_targets=$(jq -c '.wokwi_targets' ./artifacts/parent-artifacts/workflow_info.json)
57+
wokwi_types=$(jq -c '.wokwi_types' ./artifacts/parent-artifacts/workflow_info.json)
5658
qemu_tests_enabled=$(jq -r '.qemu_tests_enabled' ./artifacts/parent-artifacts/workflow_info.json)
57-
qemu_targets=$(jq -r '.qemu_targets' ./artifacts/parent-artifacts/workflow_info.json)
58-
qemu_types=$(jq -r '.qemu_types' ./artifacts/parent-artifacts/workflow_info.json)
59+
qemu_targets=$(jq -c '.qemu_targets' ./artifacts/parent-artifacts/workflow_info.json)
60+
qemu_types=$(jq -c '.qemu_types' ./artifacts/parent-artifacts/workflow_info.json)
5961
6062
hw_tests_enabled=$(jq -r '.hw_tests_enabled' ./artifacts/parent-artifacts/workflow_info.json)
61-
hw_targets=$(jq -r '.hw_targets' ./artifacts/parent-artifacts/workflow_info.json)
62-
hw_types=$(jq -r '.hw_types' ./artifacts/parent-artifacts/workflow_info.json)
63+
hw_targets=$(jq -c '.hw_targets' ./artifacts/parent-artifacts/workflow_info.json)
64+
hw_types=$(jq -c '.hw_types' ./artifacts/parent-artifacts/workflow_info.json)
6365
wokwi_tests_enabled=$(jq -r '.wokwi_tests_enabled' ./artifacts/parent-artifacts/workflow_info.json)
64-
wokwi_targets=$(jq -r '.wokwi_targets' ./artifacts/parent-artifacts/workflow_info.json)
65-
wokwi_types=$(jq -r '.wokwi_types' ./artifacts/parent-artifacts/workflow_info.json)
66+
wokwi_targets=$(jq -c '.wokwi_targets' ./artifacts/parent-artifacts/workflow_info.json)
67+
wokwi_types=$(jq -c '.wokwi_types' ./artifacts/parent-artifacts/workflow_info.json)
6668
qemu_tests_enabled=$(jq -r '.qemu_tests_enabled' ./artifacts/parent-artifacts/workflow_info.json)
67-
qemu_targets=$(jq -r '.qemu_targets' ./artifacts/parent-artifacts/workflow_info.json)
68-
qemu_types=$(jq -r '.qemu_types' ./artifacts/parent-artifacts/workflow_info.json)
69-
70-
# Sanitize the values to avoid security issues
71-
72-
# Event: Allow alphabetical characters and underscores
73-
original_event=$(echo "$original_event" | tr -cd '[:alpha:]_')
74-
75-
# Action: Allow alphabetical characters and underscores
76-
original_action=$(echo "$original_action" | tr -cd '[:alpha:]_')
77-
78-
# SHA: Allow alphanumeric characters
79-
original_sha=$(echo "$original_sha" | tr -cd '[:alnum:]')
80-
81-
# Ref: Allow alphanumeric characters, slashes, underscores, dots, and dashes
82-
original_ref=$(echo "$original_ref" | tr -cd '[:alnum:]/_.-')
83-
84-
# Conclusion: Allow alphabetical characters and underscores
85-
original_conclusion=$(echo "$original_conclusion" | tr -cd '[:alpha:]_')
86-
87-
# Run ID: Allow numeric characters
88-
original_run_id=$(echo "$original_run_id" | tr -cd '[:digit:]')
69+
qemu_targets=$(jq -c '.qemu_targets' ./artifacts/parent-artifacts/workflow_info.json)
70+
qemu_types=$(jq -c '.qemu_types' ./artifacts/parent-artifacts/workflow_info.json)
8971
9072
echo "hw_tests_enabled=$hw_tests_enabled" >> $GITHUB_OUTPUT
9173
echo "hw_targets=$hw_targets" >> $GITHUB_OUTPUT

.gitlab/scripts/gen_hw_jobs.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,6 @@ def list_project_runners() -> list[dict]:
249249
key, value = _gitlab_auth_header()
250250
sys.stderr.write(f"[DEBUG] Attempting to list runners for project {project_id}\n")
251251
sys.stderr.write(f"[DEBUG] Auth method: {key if key else 'None'}\n")
252-
if value:
253-
sys.stderr.write(f"[DEBUG] Token prefix: {value[:8]}...\n")
254252

255253
runners: list[dict] = []
256254
page = 1
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
export DEBIAN_FRONTEND=noninteractive
6+
7+
echo "[deps] Updating apt indexes"
8+
apt-get update -y
9+
10+
echo "[deps] Installing base packages"
11+
apt-get install -y jq unzip curl wget
12+
13+
echo "[deps] Installing Python packages (PyYAML)"
14+
pip3 install --no-cache-dir PyYAML
15+
16+
echo "[deps] Installing yq (mikefarah/yq) for current architecture"
17+
YQ_VERSION="v4.48.1"
18+
ARCH="$(uname -m)"
19+
case "$ARCH" in
20+
x86_64) YQ_BINARY=yq_linux_amd64 ;;
21+
aarch64|arm64) YQ_BINARY=yq_linux_arm64 ;;
22+
armv7l|armv6l|armhf|arm) YQ_BINARY=yq_linux_arm ;;
23+
i386|i686) YQ_BINARY=yq_linux_386 ;;
24+
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
25+
esac
26+
27+
echo "[deps] Downloading mikefarah/yq $YQ_VERSION ($YQ_BINARY)"
28+
wget -q https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY} -O /usr/bin/yq
29+
chmod +x /usr/bin/yq
30+
yq --version
31+
32+
echo "[deps] Dependencies installed successfully"
33+
34+

.gitlab/workflows/hardware_tests_dynamic.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,7 @@ generate-hw-tests:
1616
TEST_TYPES: $TEST_TYPES
1717
TEST_CHIPS: $TEST_CHIPS
1818
before_script:
19-
- pip install PyYAML
20-
- apt-get update
21-
- apt-get install -y jq unzip curl wget
22-
# Install mikefarah/yq (Go version) instead of kislyuk/yq (Python version)
23-
- YQ_VERSION=v4.47.2
24-
- YQ_BINARY=yq_linux_amd64
25-
- wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY} -O /usr/bin/yq
26-
- chmod +x /usr/bin/yq
27-
- yq --version
19+
- bash .gitlab/scripts/install_dependencies.sh
2820
script:
2921
- mkdir -p ~/.arduino/tests
3022
- |

.gitlab/workflows/hw_test_template.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,7 @@ hw-test-template:
3333
- echo "Running hardware tests for chip:$TEST_CHIP type:$TEST_TYPE"
3434
- echo "Pipeline ID:$PIPELINE_ID"
3535
- echo "Running hardware tests for chip:$TEST_CHIP"
36-
- apt-get update
37-
- apt-get install -y jq unzip curl wget
38-
# Install mikefarah/yq (Go version) instead of kislyuk/yq (Python version)
39-
- YQ_VERSION=v4.47.2
40-
- YQ_BINARY=yq_linux_amd64
41-
- wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY} -O /usr/bin/yq
42-
- chmod +x /usr/bin/yq
43-
- yq --version
36+
- bash .gitlab/scripts/install_dependencies.sh
4437
- rm -rf ~/.arduino/tests
4538
- mkdir -p ~/.arduino/tests/$TEST_CHIP
4639
- echo Fetching binaries for $TEST_CHIP $TEST_TYPE

boards.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42213,8 +42213,8 @@ nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideRestartCommands.1=m
4221342213
nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideRestartCommands.2=interrupt
4221442214
nano_nora.debug.additional_config=debug_config.nano_nora
4221542215

42216-
nano_nora.tools.esptool_py.program.pattern_args=--chip {build.mcu} --port "{serial.port}" --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size {build.flash_size} {build.bootloader_addr} "{build.path}/{build.project_name}.bootloader.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0xf70000 "{build.variant.path}/extra/nora_recovery/nora_recovery.ino.bin" 0x10000 "{build.path}/{build.project_name}.bin"
42217-
nano_nora.tools.esptool_py.erase.pattern_args=--chip {build.mcu} --port "{serial.port}" --before default_reset --after hard_reset erase_flash
42216+
nano_nora.tools.esptool_py.program.pattern_args=--chip {build.mcu} --port "{serial.port}" --before default-reset --after hard-reset write-flash -z --flash-mode {build.flash_mode} --flash-freq {build.flash_freq} --flash-size {build.flash_size} {build.bootloader_addr} "{build.path}/{build.project_name}.bootloader.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0xf70000 "{build.variant.path}/extra/nora_recovery/nora_recovery.ino.bin" 0x10000 "{build.path}/{build.project_name}.bin"
42217+
nano_nora.tools.esptool_py.erase.pattern_args=--chip {build.mcu} --port "{serial.port}" --before default-reset --after hard-reset erase-flash
4221842218

4221942219
nano_nora.debug.executable=
4222042220

platform.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,6 @@ tools.esptool_py_app_only.upload.protocol=serial
352352
tools.esptool_py_app_only.upload.params.verbose=
353353
tools.esptool_py_app_only.upload.params.quiet=
354354

355-
tools.esptool_py_app_only.upload.pattern_args=--chip {build.mcu} --port "{serial.port}" --baud {upload.speed} {upload.flags} --before default_reset --after hard_reset write_flash --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size {build.flash_size} {build.flash_offset} "{build.path}/{build.project_name}.bin" {upload.extra_flags}
355+
tools.esptool_py_app_only.upload.pattern_args=--chip {build.mcu} --port "{serial.port}" --baud {upload.speed} {upload.flags} --before default-reset --after hard-reset write-flash --flash-mode {build.flash_mode} --flash-freq {build.flash_freq} --flash-size {build.flash_size} {build.flash_offset} "{build.path}/{build.project_name}.bin" {upload.extra_flags}
356356

357357
tools.esptool_py_app_only.upload.pattern="{path}/{cmd}" {tools.esptool_py_app_only.upload.pattern_args}

0 commit comments

Comments
 (0)