Skip to content

Conversation

@michelleN
Copy link
Collaborator

@michelleN michelleN commented Oct 30, 2024

Generated using @ThorstenHans spin gh plugin https://github.com/ThorstenHans/spin-gh-plugin 🚀

pin gh create-action in the root dir discovers all the spin example app directories and generates the CI file here. I had to tweak a few things like deleting the unnecessary plugins, updating the yaml file name, the on: rules, workflow name, job name but I believe all of these things are configurable via the plugin flags. The next step here would be to ensure that no new example directories get missed and are easily added to the workflow file. Don't have a great story for that just yet but I figure this is a good start.

@lann
Copy link
Contributor

lann commented Oct 30, 2024

Assuming this is just building every example, I wonder if it would be better to have a build-examples.sh (with a e.g. for example_dir in examples/* ...) and just call that from the action?

@michelleN
Copy link
Collaborator Author

@lann that definitely takes care of not having to add new examples to the workflow. At first, I was thinking this setup is nice because can use act to run the workflow/build the examples locally which it does in a docker container so you don't have to fumble inconsistent rust/spin environments. If ever something is failing in CI, this setup may make it slightly easier to debug. However, you could have the same exact workflow with a build examples script and the build examples script might even be better if you actually do want to test with your local environment

The only other reason to go this route would be that the github actions output is easy to read and follow (see screenshot below). I can do my best with making the build script pretty though.
Screenshot 2024-10-30 at 11 02 52 AM

Copy link
Contributor

@rylev rylev left a comment

Choose a reason for hiding this comment

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

I'd also much prefer using a bash loop (either in a separate script or inline in the action) to loop over all examples. I think it's more important that need examples be automatically added than it is to have great output.

@lann
Copy link
Contributor

lann commented Nov 4, 2024

Oop sorry I missed your comment @michelleN. It is quite easy to group logs from bash by just printing some magic strings to stdout: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#grouping-log-lines

e.g.

for $dir in examples/*; do
  echo "::group::Building $dir"
  ...
  echo "::endgroup::"
done

@michelleN
Copy link
Collaborator Author

sounds good. I'll update and open a new PR

@michelleN michelleN closed this Nov 6, 2024
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.

3 participants