simpleinfra icon indicating copy to clipboard operation
simpleinfra copied to clipboard

feat: add upload-metrics-artifact GitHub Action ✨

Open meysam81 opened this issue 2 years ago • 2 comments

fixes rust-lang/infra-team#74

You can see the successful test-run here.

meysam81 avatar Sep 23 '23 12:09 meysam81

@jdno

Please take a look and let me know if there's anything missing.

meysam81 avatar Sep 23 '23 12:09 meysam81

On second thought, I think we can also make this action more generic with the following action.yml definition.

name: Collect CI metrics
description: Collect CI metrics and upload them to GitHub Artifacts

inputs:
  collect-metrics:
    description: Whether to collect metrics or not
    required: false
    default: "1"
  metrics-filepath:
    description: Comma or space separated list of metrics files to be uploaded to GitHub artifact
    required: true
    default: build/cpu-usage.csv
  upload-artifacts:
    description: Whether to upload artifacts or not
    required: false
    default: "1"

runs:
  using: node20
  pre-if: inputs.collect-metrics == "1"
  pre: collect.js
  main: index.js
  post-if: inputs.upload-artifacts == "1"
  post: upload.js

Please let me know if this is a better approach.

Which, then, requires only one step in a job definition instead of two if we go with the first draft of this PR.

meysam81 avatar Sep 25 '23 03:09 meysam81