containers / ocicrypt

Encryption libraries for Encrypted OCI Container images
Apache License 2.0
149 stars 33 forks source link

Mimic Travis CI with Github Actions. #75

Closed BruegelN closed 1 year ago

BruegelN commented 1 year ago

Create basic go.yml workflow to mimic behaviour of Travis CI on Github Actions in order to address https://github.com/containers/ocicrypt/issues/50. Actions for Golang version 1.16 and 1.18 are executed in parallel.

The resulting GH Actions for this can be found e.g https://github.com/BruegelN/ocicrypt/actions/runs/3629107980 .

There is a GH Action to run golangci-lint https://github.com/marketplace/actions/run-golangci-lint which would allow to combine the step of installing golangci-lint and running make check. An example can be found here: https://github.com/BruegelN/ocicrypt/commit/bb146cc59cf3d9e52d985793c9c7818936ca9fc4 and the resulting Action https://github.com/BruegelN/ocicrypt/actions/runs/3629352644. But I've decided to stick as closely to the current Travis CI as possible. Also running make check locally and the execution golangci-lint on CI are identical. What's your take on this?

Are there other events that should trigger CI to run other than pushes and PRs against main? E.g. run CI on all pushes? GH Actions has a bunch of triggers which would allow to run CI on external events or to ensure compatibility with third parties e.g a ways to schedule CI runs in a cron like manner https://docs.github.com/de/actions/using-workflows/events-that-trigger-workflows#schedule.

Please consider this as MWE and let me know if you have further suggestions/hints to improve :slightly_smiling_face:


Something I've noticed along the way: Current go.mod#L3 references go 1.12 however CI builds with go 1.16 and go 1.18.

stefanberger commented 1 year ago

LGTM. Thanks.

stefanberger commented 1 year ago

There is a GH Action to run golangci-lint https://github.com/marketplace/actions/run-golangci-lint which would allow to combine the step of installing golangci-lint and running make check. An example can be found here: BruegelN@bb146cc and the resulting Action https://github.com/BruegelN/ocicrypt/actions/runs/3629352644. But I've decided to stick as closely to the current Travis CI as possible. Also running make check locally and the execution golangci-lint on CI are identical. What's your take on this?

At least I am fine with the way you did this. Thanks.

Something I've noticed along the way: Current go.mod#L3 references go 1.12 however CI builds with go 1.16 and go 1.18.

Maybe we need to fix this as well. I wouldn't have seen it.