Skip to content

Configure GitHub Actions for building images#201

Merged
samueldr merged 13 commits intoTow-Boot:developmentfrom
jirutka:github-actions
Jul 7, 2023
Merged

Configure GitHub Actions for building images#201
samueldr merged 13 commits intoTow-Boot:developmentfrom
jirutka:github-actions

Conversation

@jirutka
Copy link
Contributor

@jirutka jirutka commented Oct 3, 2022

  • Automatically build images for each device on push and on pull requests.
  • Upload the built images to the workflow Artifacts.
  • Upload the built archives to the Release if building a release tag.

Please note that I have little to no experience with nix. This workflow works, but the prepare-cache job is quite slow (see the TODO note) and the cache (saved /nix/store) is really big.

Demo: https://github.com/jirutka/Tow-Boot/actions/runs/3177942851

The following Actions need to be enabled in the repo: actions/upload-artifact@v3, actions/download-artifact@v3, and softprops/action-gh-release@v1.

@Strit
Copy link
Contributor

Strit commented Oct 4, 2022

I think this is a great addition. It would make it really easy for people not familiar with nix, to still test a PR's builds.

@jirutka
Copy link
Contributor Author

jirutka commented Oct 12, 2022

@samueldr gentle ping

@samueldr
Copy link
Contributor

samueldr commented Nov 1, 2022

Hi, sorry for the delay.

I hate piling on apologies, but this might end-up not being needed.

I have lined-up something to finish looking into, where we would have a Hydra instance handling CD and CI. By the nature of how it works, and how Tow-Boot is setup, it will be better suited.

Note that yes, I agree, having the PRs built is needed and will be helpful.

@jirutka jirutka force-pushed the github-actions branch 3 times, most recently from d66e99e to e99a96c Compare December 23, 2022 15:59
@samueldr samueldr added this to the 20YY.MM-007 milestone Jul 3, 2023
@samueldr
Copy link
Contributor

samueldr commented Jul 3, 2023

Hi, sorry it took some time until I could get around back to this.

Somewhat related to that, announced in the Tow-Boot matrix room, if that helps understand some of the situation, and how I'm moving forward to prevent such a situation to happen again.


So, the Hydra infra project that could have been used (from a third party to all of us) is on the ice, in the end, so we'll be using GHA waiting for it to be thawed back.

I'll evaluate your changes, determine whether or not there are changes to be made, but will most likely at least keep attribution for the majority of it. I'll be looking into it once the current release is out, since it's already getting a bit long in the tooth, and should be basically ready.

@samueldr
Copy link
Contributor

samueldr commented Jul 6, 2023

WIP additions here:

Alright, so I've looked into it, and added two main things (other than trivial "cleanups"):

  • Relies on the new magic-nix-cache action
  • Updated uses to those now used by docs
  • Generates the matrix dynamically, meaning that new devices are automatically accounted for

Still TODO:

  • Configure with -CI release suffix
  • Add docs build to the CI so changes to docs are at least shown to build.
  • Test the releases thing works as expected on my personal repo

Later, once #238 is in, we'll remove the cheaty thing removing the source tarballs. Since the actually-in-use tree will be easier to point people at. I already removed its removal of config and binaries, since they are useful:

  • the binaries can be used to manually update the partition one one's device
  • the config file is quite small, and shows the in-use full config, allowing one to guesstimate at some issues down the line

@samueldr
Copy link
Contributor

samueldr commented Jul 6, 2023

😆 Nix won't stand for your shenanigans

I was curious why it was rebuilding, turns out that yes, cheating is naughty!

@samueldr
Copy link
Contributor

samueldr commented Jul 7, 2023

Thank you @jirutka, your contributions really helped me hit the ground running, and deal only with details work.

I'll be cleaning up my work tomorrow, and pushing this here. It still broadly relies on a lot of what you did.

jirutka and others added 12 commits July 7, 2023 16:59
- Automatically build images for each device on push and on pull requests.
- Upload the built images to the workflow Artifacts.
- Upload the built archives to the Release if building a release tag.
This will be replaced by the new "magic cache", which intrinsically
handles things for us.
We're now handling this within the Nix expressions. Reducing the things
in the proprietary CI tooling helps a lot, since it means the rest can
end-up being re-used down the line.
Personal preference, but I think it makes it easier to see what is a
logical unit.
This will not be necessary with the upcoming unified tree, and helps
make CI easier to deal with.
No need to continue building an outdated PR or push.
Prefer long flags for infrequently used options.
The selected actions are the now preferred options (in my opinion) for
installing Nix, and handling caching.

Then, stop messing with the store paths, and build the archive as-is.

The config and binaries are desirable:

 - config allows us to see the exact configuration used in the build,
   and compress nicely
 - binaries are the artifacts to use to manually flash, necessary under
   some circumstances where an updater process doesn't exist.
This way the CI should stay evergreen. No forgotten devices.
This differs from a handbuilt `-pre` release. Ideally we'd put the
revision ID in there too, but that means no builds ends-up cached.
@samueldr
Copy link
Contributor

samueldr commented Jul 7, 2023

With this push:

  • I rebased on current development
  • Made the devices matrix dynamic
  • Added docs to the build
  • Some misc. cleanups
  • Simplified some bits
    • Used a new pre-made nix caching action
    • Removed source from built archive

I also configured the org to allow the selected action origins

The original commit is unchanged [other than a rebase].

@samueldr samueldr merged commit 5acd417 into Tow-Boot:development Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants