Skip to content

Commit

Permalink
Merge pull request #41 from green-coding-berlin/446-send-workflow-names
Browse files Browse the repository at this point in the history
446 send workflow names
  • Loading branch information
dan-mm authored Oct 2, 2023
2 parents ed1c64e + 2d1365e commit b54aa91
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test the action locally
name: test-action

on:
push:
Expand Down
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions eco-ci-gitlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ cache:
-c $CI_COMMIT_SHA \
-sd $ECO_CI_SEND_DATA \
-s "gitlab" \
-n "gitlab-ci.yml" \
.display_results:
script:
Expand Down
21 changes: 20 additions & 1 deletion scripts/make_measurement.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -150,6 +165,10 @@ while [[ $# -gt 0 ]]; do
source="$2"
shift
;;
-n|--name)
workflow_name="$2"
shift
;;
\?)
echo "Invalid option -$OPTARG" >&2
;;
Expand Down

0 comments on commit b54aa91

Please sign in to comment.