File tree Expand file tree Collapse file tree 5 files changed +49
-0
lines changed
actions/collect-runner-stats Expand file tree Collapse file tree 5 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ inputs:
17
17
required : false
18
18
type : string
19
19
default : ' '
20
+ aws_instance_type :
21
+ required : false
22
+ type : string
23
+ default : ' '
20
24
21
25
outputs :
22
26
job_id :
54
58
CXX_COMPILER : ${{ inputs.cxx_compiler }}
55
59
BUILD_CONFIG : ${{ inputs.build_config }}
56
60
BUILD_SYSTEM : ${{ inputs.build_system }}
61
+ AWS_INSTANCE_TYPE : ${{ inputs.aws_instance_type }}
57
62
STATS_FILE : " ${{ runner.temp }}/RunnerSysStats-${{ steps.fetch_job_id.outputs.job_id }}.json"
58
63
run : " "
59
64
Original file line number Diff line number Diff line change 51
51
mkdir ${GITHUB_WORKSPACE}
52
52
fi
53
53
54
+ # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
55
+ - name : Get AWS instance type
56
+ run : |
57
+ TOKEN=$(curl -fsS --max-time 2 \
58
+ -X PUT "http://169.254.169.254/latest/api/token" \
59
+ -H "X-aws-ec2-metadata-token-ttl-seconds: 10" || true)
60
+
61
+ AWS_INSTANCE_TYPE=$(curl -fsS --max-time 2 \
62
+ -H "X-aws-ec2-metadata-token: $TOKEN" \
63
+ "http://169.254.169.254/latest/meta-data/instance-type" || true)
64
+
65
+ # if not an EC2 instance
66
+ if [[ -z "$AWS_INSTANCE_TYPE" ]]; then
67
+ AWS_INSTANCE_TYPE="self-hosted"
68
+ fi
69
+
70
+ echo "AWS_INSTANCE_TYPE=$AWS_INSTANCE_TYPE" >> $GITHUB_ENV
71
+ echo $AWS_INSTANCE_TYPE
72
+
54
73
- name : Checkout
55
74
uses : actions/checkout@v4
56
75
63
82
target_arch : wasm
64
83
cxx_compiler : emcc
65
84
build_config : Release
85
+ aws_instance_type : ${{ env.AWS_INSTANCE_TYPE }}
66
86
67
87
- name : Checkout third-party submodules
68
88
run : |
Original file line number Diff line number Diff line change 69
69
mv ${GITHUB_WORKSPACE} ${GITHUB_WORKSPACE}_${RANDOM}
70
70
mkdir ${GITHUB_WORKSPACE}
71
71
fi
72
+
73
+ # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
74
+ - name : Get AWS instance type
75
+ run : |
76
+ TOKEN=$(curl -fsS --max-time 2 \
77
+ -X PUT "http://169.254.169.254/latest/api/token" \
78
+ -H "X-aws-ec2-metadata-token-ttl-seconds: 10" || true)
79
+
80
+ AWS_INSTANCE_TYPE=$(curl -fsS --max-time 2 \
81
+ -H "X-aws-ec2-metadata-token: $TOKEN" \
82
+ "http://169.254.169.254/latest/meta-data/instance-type" || true)
83
+
84
+ # if not an EC2 instance
85
+ if [[ -z "$AWS_INSTANCE_TYPE" ]]; then
86
+ AWS_INSTANCE_TYPE="self-hosted"
87
+ fi
88
+
89
+ echo "AWS_INSTANCE_TYPE=$AWS_INSTANCE_TYPE" >> $GITHUB_ENV
90
+ echo $AWS_INSTANCE_TYPE
72
91
73
92
- name : Checkout
74
93
uses : actions/checkout@v4
82
101
target_arch : arm64
83
102
cxx_compiler : ${{ matrix.cxx-compiler }}
84
103
build_config : ${{ matrix.config }}
104
+ aws_instance_type : ${{ env.AWS_INSTANCE_TYPE }}
85
105
86
106
- name : Checkout third-party submodules
87
107
run : |
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ def parse_job(job: dict):
56
56
'runner_cpu_count' : runner_stats ['cpu_count' ],
57
57
'runner_ram_mb' : runner_stats ['ram_mb' ],
58
58
'build_system' : runner_stats ['build_system' ],
59
+ 'aws_instance_type' : runner_stats ['aws_instance_type' ],
59
60
}
60
61
except :
61
62
print ("Something went wrong while parsing the job/runner info. Debug info:" )
Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ def get_compiler_id(compiler_path):
62
62
if not build_system :
63
63
build_system = "msbuild" if compiler_id .startswith ("msvc" ) else "cmake"
64
64
65
+ aws_instance_type = os .environ .get ('AWS_INSTANCE_TYPE' , '' ).lower ()
66
+
65
67
results = {
66
68
'target_os' : os .environ .get ('TARGET_OS' ),
67
69
'target_arch' : os .environ .get ('TARGET_ARCH' ),
@@ -70,6 +72,7 @@ def get_compiler_id(compiler_path):
70
72
'cpu_count' : cpu_count ,
71
73
'ram_mb' : ram_amount ,
72
74
'build_system' : build_system ,
75
+ 'aws_instance_type' : aws_instance_type or None ,
73
76
}
74
77
with open (os .environ ['STATS_FILE' ], 'w' ) as f :
75
78
json .dump (results , f )
You can’t perform that action at this time.
0 commit comments