Skip to content

Commit 348f676

Browse files
committed
Improve genExamples.yml customisation
1 parent 56a7521 commit 348f676

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

.github/workflows/genExamples.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ on:
77
description: "Test with develop branch"
88
required: false
99
type: boolean
10+
arm_toolchain_version:
11+
description: "ARM toolchain version"
12+
required: false
13+
type: string
14+
default: "default"
15+
riscv_toolchain_version:
16+
description: "RISC-V toolchain version"
17+
required: false
18+
type: string
19+
default: "default"
1020

1121
jobs:
1222
build:
@@ -24,12 +34,14 @@ jobs:
2434
key: pico-sdk-${{ hashFiles('scripts/genExamples.py') }}
2535
- name: Run genExamples.py
2636
env:
27-
SDK_VERSION: ${{ inputs.develop && '2-develop' || '' }}
37+
SDK_VERSION: ${{ inputs.develop && '2-develop' || 'default' }}
38+
ARM_TOOLCHAIN_VERSION: ${{ inputs.arm_toolchain_version }}
39+
RISCV_TOOLCHAIN_VERSION: ${{ inputs.riscv_toolchain_version }}
2840
run: |
2941
python scripts/genExamples.py
3042
- name: List errors
3143
run: |
32-
ls -la errors-pico*
44+
ls -la errors-pico* || true
3345
- name: Upload Artifact
3446
uses: actions/upload-artifact@v4
3547
with:

scripts/genExamples.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,25 @@
3737

3838
CURRENT_DATA_VERSION = "0.17.0"
3939

40-
SDK_VERSION = os.environ.get("SDK_VERSION", "2.1.1")
41-
ARM_TOOLCHAIN_VERSION = os.environ.get("ARM_TOOLCHAIN_VERSION", "14_2_Rel1")
42-
RISCV_TOOLCHAIN_VERSION = os.environ.get(
43-
"RISCV_TOOLCHAIN_VERSION", "RISCV_ZCB_RPI_2_1_1_3"
40+
SDK_VERSION_DEFAULT = "2.1.1"
41+
ARM_TOOLCHAIN_VERSION_DEFAULT = "14_2_Rel1"
42+
RISCV_TOOLCHAIN_VERSION_DEFAULT = "RISCV_ZCB_RPI_2_1_1_3"
43+
44+
45+
def env_get_default(env_var, default):
46+
value = os.environ.get(env_var, default)
47+
if value == "default":
48+
# The action passes default in the environment variable
49+
value = default
50+
return value
51+
52+
53+
SDK_VERSION = env_get_default("SDK_VERSION", SDK_VERSION_DEFAULT)
54+
ARM_TOOLCHAIN_VERSION = env_get_default(
55+
"ARM_TOOLCHAIN_VERSION", ARM_TOOLCHAIN_VERSION_DEFAULT
56+
)
57+
RISCV_TOOLCHAIN_VERSION = env_get_default(
58+
"RISCV_TOOLCHAIN_VERSION", RISCV_TOOLCHAIN_VERSION_DEFAULT
4459
)
4560

4661
# To test with develop SDK, uncomment the line below - this will clone the SDK & picotool, and build picotool & pioasm

0 commit comments

Comments
 (0)