Live data from Hacker News

Act: Run your GitHub Actions locally

github.com

41–50 of 161 posts

Re: Act: Run your GitHub Actions locally

#41
post #39

This could've been very useful to me when setting up some cross compiler targets in a Rust project. I burned through my almost all of my 3000 actions minutes in no time at all. Had to put my project on a hiatus until the next billing period starts. It's very easy to set up a nice matrix of CPU architectures and operating systems, but phew does it churn through a lot of CPU time fast. I did not like configuring the GH…

You can also very easily start runners yourself, perhaps some unused hardware or a linode can get you there cheaper?

Re: Act: Run your GitHub Actions locally

#43
I’ve been playing with Act but I find it’s slower to run locally on my M1 MacBook than it is to just push things up to github to run.

Edit: also, why does it run things as root instead of with a use set up the same way as actions?

Re: Act: Run your GitHub Actions locally

#44
post #40

Earlier quoted context omitted.

git add […] && EDITOR=true git commit --amend && git push -f […] (You don't have to open a PR / the usual history rewriting consequences don't apply if you're just pushing to Actions to see how it reacts.) But alternatively, if you find yourself doing this a lot and it's really the code of the step that you're debugging (vs. debugging how the workflow interacts with Actions itself) I try to keep my jobs' steps pretty…

EDITOR=true is clever! Git has --no-edit as well, btw

And usefully it also has `-e` (`--edit`), so you can create an alias of

    amend = commit —-amend —-no-edit
and if you need to edit the commit message alongside merging new changes in HEAD,

    > git amend -e

Re: Act: Run your GitHub Actions locally

#45
post #22

I also struggle with CI vendor lock-in. Somebody wants to build a serverless- type ci system?

Make a BASH script that does everything on specific version of linux. And then you only have 1 line in the CI server

Doesn’t work for windows. Installing tooling is also pain.

Re: Act: Run your GitHub Actions locally

#46

I’ve used this a bunch; I actually don’t know how else you’d write and test a GitHub action. Do people just push them and hope they work and push more commits with “fix” as the message until it works?

git add […] && EDITOR=true git commit --amend && git push -f […] (You don't have to open a PR / the usual history rewriting consequences don't apply if you're just pushing to Actions to see how it reacts.) But alternatively, if you find yourself doing this a lot and it's really the code of the step that you're debugging (vs. debugging how the workflow interacts with Actions itself) I try to keep my jobs' steps pretty…

To avoid editing the commit message you can use:

  -C , --reuse-message=
    Take an existing commit object, and reuse the log message and the authorship information (including the timestamp) when creating the commit.
In the above example, commit can simply be "HEAD", when doing the amend commit:

  git commit -C HEAD --amend

Re: Act: Run your GitHub Actions locally

#48

Rather than replacing your Makefile with GH Actions, replace your GH Actions with a Makefile, and make your GH Actions run `make` in a script task. Do you really need that GH Action for pulling Docker images / installing $language_compiler / creating cloud resources ? A `docker` / `curl` / `sudo apt-get install` invocation in a Makefile / script needs to be written once and is the same in CI as on your dev machines.…

I agree. GitHub Actions should call your scripts but your scripts should not depend on GitHub Actions API.

I also suggest Bazel as a consideration alongside Make. With Bazel, you get two advantages over Make:

1. It is easier to ensure that what GitHub Actions runs and builds is the same as what you have locally, since Bazel can fetch toolchains as part of the build process

2. Using a Bazel remote cache, you do not have to repeat work if the build fails halfway and you need to make some changes before running it again.

Re: Act: Run your GitHub Actions locally

#49

Rather than replacing your Makefile with GH Actions, replace your GH Actions with a Makefile, and make your GH Actions run `make` in a script task. Do you really need that GH Action for pulling Docker images / installing $language_compiler / creating cloud resources ? A `docker` / `curl` / `sudo apt-get install` invocation in a Makefile / script needs to be written once and is the same in CI as on your dev machines.…

This is a lesson that I've learned after going all-out on actions once.

Now my makefiles in addition to the usual "make" and "make test" also support "make prerequisites" to prepare a build environment by installing everything necessary and "make ci" to run everything that CI should check. With actual implementation being scripts placed under "scripts/ci".

The scripts do provide some goodies when they are run by GitHub Actions – like folding the build logs or installing dependencies differently – but these targets also work on the developer machine.

Post reply on HN