Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add upload-metrics-artifact GitHub Action ✨ #348

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

meysam81
Copy link
Contributor

@meysam81 meysam81 commented Sep 23, 2023

fixes rust-lang/infra-team#74

You can see the successful test-run here.

@meysam81
Copy link
Contributor Author

@jdno

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

@meysam81
Copy link
Contributor Author

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.

Comment on lines +13 to +17
- name: Upload metrics artifact
uses: actions/upload-artifact@v3
with:
name: Upload metrics
path: ${{ github.workspace }}/${{ inputs.metrics-filepath }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be easier to use the actions/upload-artifact@v3 action directly? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upload metrics from PR CI as artifacts in GitHub Actions
2 participants