naggie / dsnet

FAST command to manage a centralised wireguard VPN. Think wg-quick but quicker: key generation + address allocation.
https://calbryant.uk/blog/how-to-set-up-a-wireguard-vpn-in-minutes-with-dsnet/
MIT License
679 stars 32 forks source link

GitHub action #51

Closed f-koehler closed 3 years ago

f-koehler commented 3 years ago

Dear @naggie,

please consider this PR for a Github action that automatically compiles the code (as discussed in #50). Currently it builds for the following architectures:

Adding more is straightforward. Two different go versions are used:

I discovered this nice website which tells you which go versions are supported. It is necessary to manually update the action from time to time.

As a next step it would be nice to add an action to automate releases. I do this for some python projects and it really saves a lot of time. But I think this action is a good start and enough for now.

With my best regards, @f-koehler

naggie commented 3 years ago

Thanks @f-koehler -- seems like a good start and won't affect the current release process. What happens to the built artefacts? I assume they're not stored anywhere. Does that mean this will work like a rudimentary CI system, checking each commit builds?

I'll add some unit tests some day....

f-koehler commented 3 years ago

I just grabbed the default setup-go action and modified it to use multiple go versions as well as architectures. It runs on every push to the master branch as well as on every PR against the master branch. This does not do anything with the build artifacts, they will be deleted afterwards. So it does not interfere with anything (it is just an additional thing that ensures that the code runs fine).

When unit tests (as long as go test detects them) are added they will also be run and the action will complain if one of them fails. I thought about how to do unit tests and think for such a project and think it is not as straightforward as for other types of codes. I will add my thoughts to #23 when I find the time.

One could take it further from here however and create releases automatically and/or upload to the build artifacts to them. I think something like goreleaser would be very helpful here. They also provide a GitHub action (docs are here).

One could decide how far one wants to take it. In my python projects I now trigger it by adding a special file to the repo that gets deleted by the action. This creates a tag, bumps version numbers and uploads python pacakges to PyPI. But one could also trigger it by creating and pushing a tag. Many thinks are conceivable here.

I think want I created so far is basic enough that it can be merged without causing any problems.

naggie commented 3 years ago

Excellent, thanks. That's the second time I've heard goreleaser mentioned so I'll take a look!