Skip to content

Commit d6f20c1

Browse files
committed
Add a base-path action input variable
Add a base-path action input variable and use it on all steps that are using paths, annotate that app-path can only be a single directory. The west tool creates the workspace on the parent of app-path so this is inline with that behavior, and allows using the action on repositories where the manifest lives in a subdirectory. Signed-off-by: Fabio Baltieri <[email protected]>
1 parent be22a7d commit d6f20c1

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

action.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,18 @@ description: Setup a Zephyr base project using west and downloading the Zephyr S
77
inputs:
88
app-path:
99
description: |
10-
Application code path, should contain a west.yml file if "manifest-file-name" is not specified
10+
Application code path, should contain a west.yml file if
11+
"manifest-file-name" is not specified, cannot contain multiple
12+
directories (use base-path instead)
1113
required: true
1214

15+
base-path:
16+
description: |
17+
Application base path, should contain the app-path. Defaults to "." if
18+
unspecified
19+
required: false
20+
default: .
21+
1322
manifest-file-name:
1423
description: Name of the west workspace manifest file name in "app-path"
1524
required: false
@@ -58,12 +67,14 @@ runs:
5867
fi
5968
6069
- name: Initialize
70+
working-directory: ${{ inputs.base-path }}
6171
shell: bash
6272
run: |
6373
west init -l ${{ inputs.app-path }} --mf ${{ inputs.manifest-file-name }}
6474
west update -o=--depth=1 -n
6575
6676
- name: Environment setup
77+
working-directory: ${{ inputs.base-path }}
6778
id: env-setup
6879
shell: bash
6980
run: |
@@ -126,9 +137,10 @@ runs:
126137
uses: actions/cache@v4
127138
with:
128139
path: ${{ env.PIP_CACHE_PATH }}
129-
key: pip-${{ runner.os }}-${{ hashFiles('zephyr/scripts/requirements*.txt') }}
140+
key: pip-${{ runner.os }}-${{ hashFiles(format('{0}/zephyr/scripts/requirements*.txt', inputs.base-path)) }}
130141

131142
- name: Install Python packages
143+
working-directory: ${{ inputs.base-path }}
132144
shell: bash
133145
run: |
134146
pip3 install -r zephyr/scripts/requirements.txt
@@ -137,10 +149,11 @@ runs:
137149
id: cache-toolchain
138150
uses: actions/cache@v4
139151
with:
140-
path: zephyr-sdk
152+
path: ${{ inputs.base-path }}/zephyr-sdk
141153
key: ${{ env.SDK_FILE }}-${{ inputs.toolchains }}
142154

143155
- if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
156+
working-directory: ${{ inputs.base-path }}
144157
name: Download Zephyr SDK
145158
shell: bash
146159
run: |
@@ -154,7 +167,7 @@ runs:
154167
fi
155168
156169
- name: Setup Zephyr SDK
157-
working-directory: zephyr-sdk
170+
working-directory: ${{ inputs.base-path }}/zephyr-sdk
158171
shell: bash
159172
run: |
160173
IFS=":"

0 commit comments

Comments
 (0)