Snapcraft GitHub Action

I’ve worked-up and got operational a GitHug Action based on my work documented on my blog. Basically, the project was to get Docker-based containers building Snaps for any of the supported architectures. The GitHug Action evolves this to a reusable Action that is simple to implement without knowing the intricate details of getting it working. The concept should also be transferrable to any CI/CD platform that lets you start a container with Docker’s --privileged flag.

15 Likes

Very nice! I may switch to using this instead of LP for some of my snaps!

/me hugs @lucyllewy

3 Likes

Thanks for creating this @lucyllewy, I’ve been waiting for GitHub to get round to providing arm64 runners but who knows when that will be, but this looks to be a good workaround. I’ve tried using this action to build arm64, but it seems to just be doing an amd64 build under what I was expecting to be the arm64 build. I’m pretty sure I’ve followed the instructions to correctly setup multiarch builds.

The snap I’ve configured the action on: https://github.com/Nightmayr-snaps/ppsspp-snap/blob/master/snap/snapcraft.yaml
arm64 build: https://github.com/Nightmayr-snaps/ppsspp-snap/runs/1407004877?check_suite_focus=true
Workflow file: https://github.com/Nightmayr-snaps/ppsspp-snap/blob/master/.github/workflows/edge.yml

2 Likes

Sorry about that, it was broken as you spotted. Thanks for letting me know. It should be fixed now if you’re using @v1 or @master as your version specifier in GitHub Actions. Otherwise you simply need to update the version to either of @v1, @v1.2.0, or @master. The preferred will be v1 because that will be updated to always point to the latest v1.x.y versions.

2 Likes

Thanks, can confirm it works for me now using @v1 :+1:

2 Likes

Thank you for this! Just one observation: If snapcraft-args is empty, entrypoint.sh will call snapcraft like Executing: 'snap run snapcraft '' ', which results in Error: No such command ''..

Can you share your GitHub Actions workflow so I can see what you’re doing? Preferably a link to a public GitHub repository so I can investigate the workflow yaml and the log spew from running.

I’m seeing an error with my workflow, seems similar to what @ppd mentioned. The workflow now appears to try and run snapcraft with some arguments but in my case I haven’t specified snapcraft_args so it runs as snap run snapcraft ''. The repo is the same one mentioned in my previous comment, still using @v1

Thanks. I think I’ve isolated a fix, which is being built now: https://github.com/diddlesnaps/snapcraft-container/actions/runs/377578817

2 Likes

Hi, @lucyllewy! Will there be an .gitlab-ci.yml template file so I can publish my snaps using GitLab CI in the future?

@ajhalili2006 I’ve written one for you:

https://gitlab.com/diddledan/snapcraft-multiarch-gitlab-ci

3 Likes