-
Notifications
You must be signed in to change notification settings - Fork 4
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
Workflow improvement for ease of replicability #466
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Never expected to see an external contribution here.
I think these are good changes, though I'd approach the build_and_run
script a little differently (see comments).
scripts/build_and_run.sh
Outdated
echo "--------------------------------------------------" >> "$LOGFILE" | ||
echo "COMMAND: $COMMAND $ARGS" >> "$LOGFILE" | ||
echo "OUTPUT:" >> "$LOGFILE" | ||
eval "$COMMAND $ARGS" >> "$LOGFILE" 2>&1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eval "$COMMAND $ARGS" >> "$LOGFILE" 2>&1 | |
$COMMAND "$ARGS" >> "$LOGFILE" 2>&1 |
Although right now you're always passing all args via $COMMAND
(the commands are quoted together with the args). $ARGS
is always empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will check this one as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Krzysztof Bieganski <krzysztof@biegan.ski>
Co-authored-by: Krzysztof Bieganski <krzysztof@biegan.ski>
Co-authored-by: Krzysztof Bieganski <krzysztof@biegan.ski>
Co-authored-by: Krzysztof Bieganski <krzysztof@biegan.ski>
Co-authored-by: Krzysztof Bieganski <krzysztof@biegan.ski>
Co-authored-by: Krzysztof Bieganski <krzysztof@biegan.ski>
scripts/build_and_run.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I forgot to submit this comment, and it's the most important one.
First, a nit: let's rename this script to build_and_run
; the language it's in is not important to the usage.
More importantly, this script is not being tested, so it's guaranteed to stop working in a few months. The way I would approach this is:
- Define a function for each step:
function build() { ... } function gen_tests() { ... } function run_tests() { ... } function gen_report() { ... }
- Parse flags like
--build
,--run-tests
, etc.:# If no arguments are given, run all steps if [[ $# -eq 0 ]] ; then for BRANCH in $(ls $MAIN_DIR/verilator); do build $BRANCH gen_tests $BRANCH done run_tests gen_report fi # Parse arguments and run individual steps while [ -n "$1" ]; do case "$1" in --build) shift; build "$1";; --gen-tests) shift; gen_tests "$1";; --run-tests) run_tests;; --gen-report) gen_report;; --help) echo "Usage: $0 [--build <branch>] [--gen-tests <branch>] [--run-tests] [--gen-report]"; exit 0;; *) echo "Option $1 not recognized" >&2; exit 1;; esac shift done
- Replace the original CI steps with script invocations like:
etc.
scripts/build_and_run ${{ matrix.VERILATOR_BRANCH }}
Looks great! The last thing to do is to use the script in CI instead of the explicit commands. scripts/build_and_run --build ${{ matrix.VERILATOR_BRANCH }} |
Hey, glad that changes look okay. I am currently testing the workflow changes and will let you know once I complete them. Also, I deemed it appropriate to add the "all" option to the verilator build and test generation for possible utilization. The current workflow doesn't seem to be requiring it, but I wanted to let you know in advance that maybe you, who are most likely much more familiar with github workflows than me, who haven't worked with them before at all, :D could find it useful later, and it would still be nice to have for non-workflow users. I'll probably complete the changes tomorrow. |
Hey again, I am currently trying to update the workflow yaml but I have faced some problems. My progress so far:
to the workflow in order to allow running it by itself if not cloned recursively. That seems to be working OK.
Both of these methods caused the error log below during the "Upload test output" task:
But I couldn't find anything regarding this environment variable anywhere within the project. I found this issue which looks like a bug regarding act itself, and there were previous occurrences of this error before; however, since the current workflow works correctly unless I modify it, I suspect that it is more about what I am trying to do rather than the tool itself. When I run the first three steps of the build_and_run script, there are no issues at all, but the run-tests step seems to be problematic somehow, and I couldn't figure it out. When I only modify the previous tasks and leave the "Run Tests" task as it was, everything works correctly. Do you have any ideas about what may be causing this? I am now updating the repository by adding both variations of build_and_run scripts to the repository, if you'd like to have a closer look. |
…the method used in GitHub workflow for running tests.
Updated repository based on the latest comment I wrote. I think after only getting this "Run tests" task up and running, this PR is highly likely to be ready for merge. |
I think this is a limitation of Looks good overall. |
I noticed that in README and bash script execution that I wrote based on README, we ran tests using a very simple command:
However, there are plenty of flags employed within the workflow task where the tests are run:
So, the _act script employs the routine within test.yml meanwhile the baseline script is based on README routine. Since both caused errors with act, I couldn't determine which would be more appropriate. I can leave it in the original state that you approved before and remove the _act version of the script if it is okay on your part. However, if that's the case, we should remove the act section from README since it would be incompatible. Then it would be "run build_and_run if you want to run locally, and use workflow if you want to do it with GitHub actions". If that is okay, I can remove the additional script, modify README to its final form, and finalize the PR state of the branch. |
The README command just runs all tests and generates a report. When we do |
Hi again, I did the update as you asked now. Thanks for all the feedback and guidelines throughout the process that led me to understand this repository much better. I also learned a lot through the process since this was my first contribution to a public repository. I'm eagerly looking forward to future updates and developments regarding UVM support in the future. Wishing you all a wonderful day. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This comes from Issue #456. Three main updates are implemented: