Skip to content

Commit

Permalink
Fixes invalid labels
Browse files Browse the repository at this point in the history
  • Loading branch information
ribalba authored Aug 7, 2024
1 parent 0f0eb43 commit 19b157f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 11 deletions.
47 changes: 37 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test-action
name: test-action-test-file

on:
pull_request:
Expand Down Expand Up @@ -26,10 +26,11 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-20.04]

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
path: .

- name: API Base Debug
run: |
Expand Down Expand Up @@ -59,7 +60,7 @@ jobs:
uses: ./
with:
task: get-measurement
label: "Sleep 3s"
label: "echo Hellos; $SHELL; \""

- name: Dump ECO-CI CPU Step actual processed
run: |
Expand All @@ -69,26 +70,52 @@ jobs:
run: |
cat /tmp/eco-ci/energy-step.txt
- name: Filesystem
run: timeout 10s ls -alhR /usr/lib
continue-on-error: true
- name: Sleep 3
run: sleep 3

- name: Test measurement 2
uses: ./
with:
task: get-measurement
label: "ls -alhR /usr/lib"
label: "(Soo this is something); & ; echo $SHELL"

- name: Sleep 3
run: sleep 3

- name: Test measurement 2
- name: Test measurement 3
uses: ./
with:
task: get-measurement
label: "Sleep 3s"
label: 'Environment setup (OS ${{ matrix.os }}, lint)'

# - name: Sleep 3
# run: sleep 3

# There is currently no way of catching this IMHO
# - name: Test measurement 4
# uses: ./
# with:
# task: get-measurement
# label: without quotes'; echo

- name: Sleep 3
run: sleep 3

- name: Test measurement 5
uses: ./
with:
task: get-measurement
label: without quotes"; echo

# - name: Sleep 3
# run: sleep 3

# There is currently no way of catching this IMHO
# - name: Test measurement 6
# uses: ./
# with:
# task: get-measurement
# label: 'without quotes'''

- name: Dump ECO-CI CPU
run: |
Expand Down
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ runs:
NAME: ${{ github.workflow }}
shell: bash
run: |
${{github.action_path}}/scripts/make_measurement.sh make_measurement "${{inputs.label}}"
label='${{ contains(inputs.label, '"') && 'No quotes allowed in labels' || inputs.label }}'
label_cleaned=$(echo "$label" | tr -d "$&;\'")
echo "Cleaned label: $label_cleaned"
"${{ github.action_path }}/scripts/make_measurement.sh" make_measurement "$label_cleaned"
data_file="/tmp/test.bash"
lap_data_file="/tmp/eco-ci/lap-data.json"
if [[ -e $lap_data_file ]]; then
Expand Down

0 comments on commit 19b157f

Please sign in to comment.