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

Question: how should analysis-result be used? #1

Open
pauldreik opened this issue Oct 10, 2020 · 7 comments
Open

Question: how should analysis-result be used? #1

pauldreik opened this issue Oct 10, 2020 · 7 comments
Labels
bug Something isn't working

Comments

@pauldreik
Copy link

Thanks for writing this action! I got it running, but now I want to store the results as an artifact.
I don't understand how the analysis-result is to be interpreted. Should it be set to a filename where to write the results? How do I get the results into a file I can store as a github action artifact?

On a side note. Is it possible to setup some limit, like failing the job if the binary size increases by more than x bytes (or percent)?

@djarek
Copy link
Owner

djarek commented Oct 10, 2020

analysis-result contains the raw string of the result. You should just be able to useit, just like any workflow variable, with ${{ analysis-result }}. I planned on using the output in boost.json's CI, but I ended up not using it. If it doesn't work let me know, I'll try to fix it.

As for setting a hard limit - it might make sense for a constrained embedded system (you obviously have a hard cap on flash size), but I'd avoid doing it in other projects. I think it's hard to make a heuristic that determines whether the size increase is warranted.

Oh, btw, Bloaty has mutliple output formats so if you want to parse the results with something else, I can add an option to use that flag. I didn't include it, because I didn't have a need for it so far. CSV might be easier to parse if you end up deciding to include a size-limiting job.

@djarek djarek added the question Further information is requested label Oct 10, 2020
@pauldreik
Copy link
Author

Ok, how do I get the contents of that variable into a file? I tried

      - name: "store results"
        run: |
          echo -E ${{ analysis-result }} > bloaty-sizes.txt

But it gives me this error:

The workflow is not valid. .github/workflows/bloaty.yml (Line: 29, Col: 14): Unrecognized named-value: 'analysis-result'. Located at position 1 within expression: analysis-result,.github/workflows/bloaty.yml (Line: 50, Col: 14): Unrecognized named-value: 'analysis-result'. Located at position 1 within expression: analysis-result

I suspect that variable "ends it's scope" when the bloaty action ends?

What is the best way for me to get the result into bloaty-sizes.txt so I can store it as an artifact?

@djarek
Copy link
Owner

djarek commented Oct 11, 2020

https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs

This suggests that workflow variables are scoped, so in order to refer to the variable, you need to use the id: ${{ my-step-id.analysis-result }}, where the id is defined in the bloaty step, e.g.:

    - name: Bloat analysis
        id: my-step-id
        uses: djarek/bloaty-analyze@v1
        with:
            file: build/mylib.a

@pauldreik
Copy link
Author

Thanks for the reference! I made progress. However, I think the action only assigns the first row to the variable. I get

    FILE SIZE        VM SIZE    

from the analysis-results variable. If I look in the log output during the action, the body of the table seems to be written to the terminal rather than captured by the variable.

I do not know if you can access it, but here is a link to the output: https://github.com/simdjson/simdjson/runs/1240273039?check_suite_focus=true and here is the workflow: https://github.com/pauldreik/simdjson/blob/pauldreik/bloaty/.github/workflows/bloaty.yml

@djarek
Copy link
Owner

djarek commented Oct 14, 2020

Hmm, I didn't expect this behavior. I'll consider it to be a bug and I'll fix it.

@djarek djarek added bug Something isn't working and removed question Further information is requested labels Oct 14, 2020
@pauldreik
Copy link
Author

Thanks. While we are at it, may I wish for an optional parameter specifying a file which the results are written to?

@pauldreik
Copy link
Author

@djarek friendly reminder, do you intend to fix this in the near future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants