-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GitHub actions for test and linting #62
Conversation
c7fbc03
to
6a4e2bc
Compare
@jeffwidman @dims @pacoxu @aboch PTAL
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Since this adds github actions that are versioned, we should probably also add a stanza to https://github.com/vishvananda/netns/blob/master/.github/dependabot.yml to monitor/bump the actions. Feel free to include as part of this PR (albeit in a separate commit), but if you're not sure how to do that, I can handle it in a separate PR. |
Ah, interesting; looks like go1.12 is actually an issue with the updated golang.org/x/sys.
Maybe it's time now to update to something newer (I think I saw some projects are still on go1.15, let me try if that works) |
b178c5d
to
54471b1
Compare
I opened #64 to update the minimum go version 👍 (I'll rebase this PR once that's merged to remove the extra commit; CI is happy on thaJeztah#1) |
Alright; rebased; this one should be ready for review (thaJeztah#1 is still happy) |
Oh! I forgot about that one; I'd have to look up how to set that up, so if you have time to handle that, that'd be appreciated 🤗 ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small suggestions/questions
.github/workflows/test.yml
Outdated
# using newer versions than that, so we can drop the old version if | ||
# it becomes too much of a burden. | ||
go-version: [1.17.x, 1.19.x] | ||
os: [ubuntu-20.04, ubuntu-22.04] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also test on windows
? To ensure no runtime errors in the future?
I realize today there's no tests that will run on windows, but still seems best to set it in the matrix proactively for if/when there might be some down the road... it'll also catch compile errors even w/o any tests I think??
.github/workflows/test.yml
Outdated
# currently not much of a burden. Most projects using this module are | ||
# using newer versions than that, so we can drop the old version if | ||
# it becomes too much of a burden. | ||
go-version: [1.17.x, 1.19.x] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go-version: [1.17.x, 1.19.x] | |
go-version: [1.17.x, 'stable'] |
This lets us always default to the latest release: https://github.com/actions/setup-go#using-stableoldstable-aliases
Given the extremely low activity on this repo, I'd much rather use stable
than having to bump the pins, because we're more likely to catch issues that way...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly, they also support picking up the version from go.mod
, but doesn't like like it's possibly to cleanly do this as part of a matrix: https://github.com/actions/setup-go#getting-go-version-from-the-gomod-file
.github/workflows/validate.yml
Outdated
matrix: | ||
# We only run on the latest version of go, as some linters may be | ||
# version-dependent (for example gofmt can change between releases). | ||
go-version: [1.19.x] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go-version: [1.19.x] | |
go-version: ['stable'] |
Again, I realize it's non-deterministic, but I think for this particular repo it's probably the better way to go...
Handled in: |
@thaJeztah I left some minor feedback, I know we're both involved with a lot of projects, so any chance of getting this across the line while it's still fresh in our minds? |
Doh! Saw your comments, and then forgot about them. Thanks for the ping; yes, let me look at those 👍 |
Test against the "oldest" supported version and the current version of go. Go 1.17 is kept in this matrix as it is the minimum version specified in go.mod, and maintaining compatibility with go 1.17 is currently not much of a burden. Most projects using this module are using newer versions than that, so we can drop the old version if it becomes too much of a burden. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Linting is disabled on Windows, as the current build-tags do not properly exclude non-unix platforms; level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 1.0348ms" Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:28:18: Stat_t not declared by package unix" Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:29:17: Fstat not declared by package unix" Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:32:17: Fstat not declared by package unix" Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:43:13: Stat_t not declared by package unix" Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:44:17: Fstat not declared by package unix" Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:56:13: Stat_t not declared by package unix" Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:57:17: Fstat not declared by package unix" Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:71:17: Close not declared by package unix" Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
git diff --exit-code | ||
- name: Test | ||
run: | | ||
go test -exec "sudo -n" -v ./... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. Somewhat surprised this worked on Windows (with the sudo
), but perhaps because there's currently no tests. Looks like Ci is happy (thaJeztah#1), so worst case, it'll explode if we would add non-linux tests 😂
Okay; updated. I think this should be ready for another review 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
Thanks! |
No description provided.