Skip to content

Commit becb311

Browse files
committed
Fix artifacts directory in check-netlogo action
1 parent a9b5bf5 commit becb311

1 file changed

Lines changed: 31 additions & 14 deletions

File tree

check-netlogo/action.yaml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,35 @@ runs:
6666
if: runner.os == 'Windows'
6767
run: |
6868
# Install dependencies (Windows)
69+
# set -x
6970
7071
choco install ripgrep -y
7172
shell: pwsh
7273

7374
- name: Create artifacts directory
75+
id: artifacts-dir
7476
run: |
7577
# Create artifacts directory
7678
# set -x
7779
78-
mkdir -p "${RUNNER_TEMP}/check-netlogo"
80+
artifacts_dir="${RUNNER_TEMP}/check-netlogo"
81+
mkdir -p "${artifacts_dir}"
82+
83+
case ${RUNNER_OS} in
84+
"Windows")
85+
artifacts_dir="${artifacts_dir}/windows"
86+
;;
87+
"macOS")
88+
artifacts_dir="${artifacts_dir}/macos"
89+
;;
90+
"Linux")
91+
artifacts_dir="${artifacts_dir}/linux"
92+
;;
93+
esac
94+
95+
mkdir -p "${artifacts_dir}"
96+
97+
echo "path=${artifacts_dir}" >> "${GITHUB_OUTPUT}"
7998
shell: bash
8099

81100
- name: Search for NetLogo models
@@ -140,23 +159,21 @@ runs:
140159
if: steps.netlogo-models.outputs.found == 'true'
141160
run: |
142161
# Run experiments
162+
# set -x
163+
143164
export JAVA_TOOL_OPTIONS="-Dcom.sun.media.jai.disableMediaLib=true"
144165
145-
readarray -t models <<< "${{steps.netlogo-models.outputs.models}}"
166+
artifacts_dir="${{steps.artifacts-dir.outputs.path}}"
146167
147-
for model_file in "${models[@]}"; do
168+
while IFS= read -r model_file; do
148169
[[ -z "${model_file}" ]] && continue
149170
150-
readarray -t experiments < <(
151-
rg -oP '(?<=<experiment name=")[^"]+' "${model_file}"
152-
)
153-
154-
for experiment_name in "${experiments[@]}"; do
171+
while IFS= read -r experiment_name; do
155172
[[ -z "${experiment_name}" ]] && continue
156173
157174
echo \
158175
"Running '${model_file}'" \
159-
"with experiment '${experiment_name}''."
176+
"with experiment '${experiment_name}'."
160177
161178
sanitized_experiment_name=$( \
162179
echo "${experiment_name}" \
@@ -171,7 +188,7 @@ runs:
171188
172189
output_file=$( \
173190
printf "%s/%s_%s.csv" \
174-
"${RUNNER_TEMP}/check-netlogo" \
191+
"${artifacts_dir}" \
175192
"${sanitized_model_name}" \
176193
"${sanitized_experiment_name}" \
177194
)
@@ -182,11 +199,11 @@ runs:
182199
--experiment "${experiment_name}" \
183200
--table "${output_file}" \
184201
2> >(grep -v "Could not find mediaLib accelerator")
185-
done
186-
done
202+
done < <(rg -oP '(?<=<experiment name=")[^"]+' "${model_file}")
203+
done <<< "${{steps.netlogo-models.outputs.models}}"
187204
188205
shopt -s nullglob
189-
files=("${RUNNER_TEMP}"/check-netlogo/*.csv)
206+
files=("${artifacts_dir}"/*.csv)
190207
191208
if [[ ${#files[@]} -gt 0 ]]; then
192209
echo "found=true" >> "${GITHUB_OUTPUT}"
@@ -207,6 +224,6 @@ runs:
207224
uses: actions/upload-artifact@v4
208225
with:
209226
name: experiments-output
210-
path: "${{runner.temp}}/check-netlogo/"
227+
path: ${{steps.artifacts-dir.outputs.path}}
211228
retention-days: 90
212229
if-no-files-found: warn

0 commit comments

Comments
 (0)