diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7c5ef43d..1cf61641 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Test the action locally +name: test-action on: push: diff --git a/action.yml b/action.yml index 08e23e97..013abe8f 100644 --- a/action.yml +++ b/action.yml @@ -134,9 +134,11 @@ runs: - if: inputs.task == 'get-measurement' id: run-lap-model name: Running estimation model + env: + NAME: ${{ github.workflow }} shell: bash run: | - ${{github.action_path}}/scripts/make_measurement.sh -l "${{inputs.label}}" -r "${{ github.run_id }}" -b "${{inputs.branch}}" -R "${{ github.repository }}" -c ${{ github.sha }} -sd ${{inputs.send-data}} -s "github" + ${{github.action_path}}/scripts/make_measurement.sh -l "${{inputs.label}}" -r "${{ github.run_id }}" -b "${{inputs.branch}}" -R "${{ github.repository }}" -c ${{ github.sha }} -sd ${{inputs.send-data}} -s "github" -n $NAME lap_data_file="/tmp/eco-ci/lap-data.json" echo "data-lap-json=$(cat $lap_data_file)" >> $GITHUB_OUTPUT diff --git a/eco-ci-gitlab.yml b/eco-ci-gitlab.yml index 722fc95d..eeb144cf 100644 --- a/eco-ci-gitlab.yml +++ b/eco-ci-gitlab.yml @@ -44,6 +44,7 @@ cache: -c $CI_COMMIT_SHA \ -sd $ECO_CI_SEND_DATA \ -s "gitlab" \ + -n "gitlab-ci.yml" \ .display_results: script: diff --git a/scripts/make_measurement.sh b/scripts/make_measurement.sh index e52f1928..fb668cce 100755 --- a/scripts/make_measurement.sh +++ b/scripts/make_measurement.sh @@ -87,7 +87,22 @@ function make_measurement() { unit="mJ" model_name_uri=$(echo $MODEL_NAME | jq -Rr @uri) - curl -X POST "$add_endpoint" -H 'Content-Type: application/json' -d "{\"energy_value\":\"$value_mJ\",\"energy_unit\":\"$unit\",\"cpu\":\"$model_name_uri\",\"commit_hash\":\"${commit_hash}\",\"repo\":\"${repo}\",\"branch\":\"${branch}\",\"workflow\":\"$WORKFLOW_ID\",\"run_id\":\"${run_id}\",\"project_id\":\"\",\"label\":\"$label\", \"source\":\"$source\", \"cpu_util_avg\":\"$cpu_avg\", \"duration\":\"$time\"}" + curl -X POST "$add_endpoint" -H 'Content-Type: application/json' -d "{ + \"energy_value\":\"$value_mJ\", + \"energy_unit\":\"$unit\", + \"cpu\":\"$model_name_uri\", + \"commit_hash\":\"${commit_hash}\", + \"repo\":\"${repo}\", + \"branch\":\"${branch}\", + \"workflow\":\"$WORKFLOW_ID\", + \"run_id\":\"${run_id}\", + \"project_id\":\"\", + \"label\":\"$label\", + \"source\":\"$source\", + \"cpu_util_avg\":\"$cpu_avg\", + \"duration\":\"$time\", + \"workflow_name\":\"$workflow_name\" + }" fi # write data to output @@ -150,6 +165,10 @@ while [[ $# -gt 0 ]]; do source="$2" shift ;; + -n|--name) + workflow_name="$2" + shift + ;; \?) echo "Invalid option -$OPTARG" >&2 ;;