archlinuxhardened / selinux

PKGBUILDs to build SELinux enabled packages for Arch Linux
146 stars 25 forks source link

GitHub actions starter #67

Closed tqre closed 3 years ago

tqre commented 3 years ago

I have created a simple GitHub Actions workflow that builds the packages with docker using the Dockerfile we have. After the workflow has been completed, the build artifacts (*.pkg.tar.zst) are available for downloading as a one big zip file via the Actions tab and the relevant workflow run.

Ideas/features/issues:

Example workflow run with artifact download link: https://github.com/tqre/selinux/actions/runs/408409124

tqre commented 3 years ago

Current working status: https://github.com/tqre/selinux/actions/runs/435154042

tqre commented 3 years ago

Got automatic releases working too now. Latest results are here: https://github.com/tqre/selinux/releases/tag/ArchLinux-SELinux https://github.com/tqre/selinux/actions/runs/436691616

Some more ideas to consider:

fishilico commented 3 years ago

This looks great! Some comments:

Such tests could be implemented in a shell script which is copied in the VM and executed from there.

Anyway, your Pull Request looks fine as it is. I suggest merging it as-is, so that we can both work on improving it. What do you think? Is this PR ready for merge?

By the way, "Make an actual pacman repo out of the releases page?" would be really great :)

fishilico commented 3 years ago

While testing the action on my repository, I got an error in https://github.com/fishilico/arch-selinux/runs/1610918585?check_suite_focus=true#step:4:11 :

Run qemu-img create -f raw archlinux.raw 8G
/home/runner/work/_temp/f8db4ff7-eb35-417d-b538-ec3b8269f24a.sh: line 1: qemu-img: command not found
Error: Process completed with exit code 127.

I guess this is due to the fact that new repositories use Ubuntu 20.04 runners for when the GH Actions configuration states ubuntu-latest (you are using Ubuntu 18.04 runners in your repository). I guess you need to install qemu-utils too.

tqre commented 3 years ago

Thanks for the comments and good suggestions. Yesterday GH Actions was still using Ubuntu 18.04. Apparently 'soon' is today, so installing qemu-utils is needed from today on. I'll test and fix it.

No additional configurations are needed regarding to secrets.GITHUB_TOKEN, writing rights to the repository are enough.

I wanted to have the -v tag with restorecon to see it work as it generates no output otherwise. I guess the main idea is to have a concise output that the tests and commands work, and having the whole filesystem listed is not the most compact of a solution.

tqre commented 3 years ago

It looks like my GH Actions workflows still take 18.04 when using the latest -tag. Looking at the workflow you linked, the install command doesn't actually install anything. I tried to make it work with 20.04, but I get the same error even after updating and upgrading the runner fully.

The quick solution is to run the workflow on 18.04, as it looks like 20.04 is not yet fully implemented. https://github.com/actions/virtual-environments/issues/1816

tqre commented 3 years ago

I managed to double the commits when merging master into this branch as my workflow is a bit messy I guess. I forgot I had most of the commits already on my fork's master branch for testing the master branch triggers for GH Actions...

You can probably cherry pick the commits avoiding doubles to keep the repo history clean...

EDIT: found a way, still learning to do with git it seems :)

fishilico commented 3 years ago

Thanks for cleaning up your git history! In the mean time I tested it and it ran nicely (using Ubuntu 18.04 runners). So I merged this PR, in order to have a "minimum viable product" live :)