Skip to content
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

update to go 1.17 as minimum, fix and update actions #30

Merged
merged 2 commits into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 59 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,77 @@
name: Test
on: [push, pull_request]
on:
push:
tags:
- v*
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
test:
permissions:
contents: read # for actions/checkout to fetch code
timeout-minutes: 10

strategy:
matrix:
go-versions: [1.12.x, 1.13.x, 1.14.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
# 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.
go-version: [1.17.x, 1.19.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: go mod tidy
run: |
go mod tidy
git diff --exit-code
- name: Ensure IPVS module
run: sudo modprobe ip_vs
run: |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's a need for the multiline string syntax when we only have one line

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah, I made the change as I was syncing with other repositories (made it easier to compare).

Happy to revert if you prefer though (let me know)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That justification makes sense; ultimately using composite actions among the repos that are very similar (e.g. these small modules) is probably something we should explore.

sudo modprobe ip_vs
- name: Test
run: sudo go test -v ./...
run: |
go test -exec "sudo -n" -v ./...
lint:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
# 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
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Lint
run: |
docker run --rm -v `pwd`:/go/src/github.com/moby/ipvs -w /go/src/github.com/moby/ipvs \
golangci/golangci-lint:v1.23.8 golangci-lint run --disable-all -v \
-E govet -E misspell -E gofmt -E ineffassign -E golint
uses: golangci/golangci-lint-action@v3
with:
version: "v1.50.1"
skip-cache: true
args: --print-resources-usage --timeout=5m --verbose

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
8 changes: 8 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
linters:
disable-all: true
enable:
- gofmt
- govet
- ineffassign
- misspell
- revive
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
module github.com/moby/ipvs

go 1.13
go 1.17

require (
github.com/sirupsen/logrus v1.4.2
github.com/vishvananda/netlink v1.1.0
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527
)

require github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this indirect should go away if we update the minimum logrus version