From 07d9bdd8c4e1acc05e34d9a0bdcc4f63e7438a2a Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 30 Mar 2021 09:17:16 -0500 Subject: [PATCH] ci: switch to GitHub Actions and bump Go to 1.15 Let's join the 21st century. Signed-off-by: Dan Williams --- .github/workflows/test.yaml | 59 +++++++++++++++++++++++++++++++++++++ .travis.yml | 48 ------------------------------ pkg/ocicni/ocicni.go | 4 +-- 3 files changed, 61 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/test.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..533c959a --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,59 @@ +--- +name: test + +on: ["push", "pull_request"] + +env: + GO_VERSION: "1.15" + LINUX_ARCHES: "amd64 386 arm arm64 s390x mips64le ppc64le" + +jobs: + build: + name: Build all linux architectures + runs-on: ubuntu-latest + steps: + - name: setup go + uses: actions/setup-go@v1 + with: + go-version: ${{ env.GO_VERSION }} + - uses: actions/checkout@v2 + + - name: Build on all supported architectures + run: | + set -e + for arch in ${LINUX_ARCHES}; do + echo "Building for arch $arch" + GOARCH=$arch make + rm bin/* + done + + test-linux: + name: Run tests on Linux amd64 + runs-on: ubuntu-latest + steps: + - name: setup go + uses: actions/setup-go@v1 + with: + go-version: ${{ env.GO_VERSION }} + - uses: actions/checkout@v2 + + - name: Install test binaries + env: + GO111MODULE: off + run: | + go get golang.org/x/tools/cmd/cover + go get github.com/modocache/gover + go get github.com/mattn/goveralls + go get -t ./... + + - name: test + run: PATH=$PATH:$(go env GOPATH)/bin COVERALLS=1 ./test_linux.sh + + - name: Send coverage to coveralls + env: + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + PATH=$PATH:$(go env GOPATH)/bin + gover + goveralls -coverprofile=gover.coverprofile -service=github + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0848b988..00000000 --- a/.travis.yml +++ /dev/null @@ -1,48 +0,0 @@ -language: go -dist: trusty - -go: - - 1.9.x - - 1.10.x - - 1.11.x - - 1.12.x - -env: - matrix: - - TARGET=amd64 - - TARGET=arm - - TARGET=arm64 - - TARGET=ppc64le - - TARGET=s390x - -matrix: - fast_finish: true - -# Ubuntu 14.04 (trusty) doesn't have a new enough util-linux for nsenter, -# so we have to build it ourselves. -before_install: - - wget https://www.kernel.org/pub/linux/utils/util-linux/v2.24/util-linux-2.24.1.tar.gz -qO - | tar -xz -C . - - sudo apt-get update - - sudo apt-get install -y libncurses5-dev libslang2-dev gettext zlib1g-dev libselinux1-dev debhelper lsb-release pkg-config po-debconf autoconf automake autopoint libtool - - pushd util-linux-2.24.1 - - ./autogen.sh - - ./configure - - make - - sudo cp ./nsenter /usr/bin - - popd - - rm -rf util-linux-2.24.1 - -install: - - go get golang.org/x/tools/cmd/cover - - go get github.com/modocache/gover - - go get github.com/mattn/goveralls - - go get -t ./... - -script: - - make check - -notifications: - email: false - -git: - depth: 9999999 diff --git a/pkg/ocicni/ocicni.go b/pkg/ocicni/ocicni.go index 5f3b3ac0..ef89d8f9 100644 --- a/pkg/ocicni/ocicni.go +++ b/pkg/ocicni/ocicni.go @@ -541,7 +541,7 @@ func (plugin *cniNetworkPlugin) SetUpPodWithContext(ctx context.Context, podNetw if err := plugin.forEachNetwork(&podNetwork, false, func(network *cniNetwork, podNetwork *PodNetwork, rt *libcni.RuntimeConf) error { result, err := network.addToNetwork(ctx, rt, plugin.cniConfig) if err != nil { - logrus.Errorf("Error while adding pod to CNI network %q: %s", network.name, err) + logrus.Errorf("Error while adding pod todddddd CNI network %q: %s", network.name, err) return err } results = append(results, NetResult{ @@ -810,7 +810,7 @@ func buildCNIRuntimeConf(podNetwork *PodNetwork, ifName string, runtimeConfig Ru } // Propagate existing CNI_ARGS to non-k8s consumers - for _, kvpairs := range strings.Split(os.Getenv("CNI_ARGS"), ";"){ + for _, kvpairs := range strings.Split(os.Getenv("CNI_ARGS"), ";") { if keyval := strings.SplitN(kvpairs, "=", 2); len(keyval) == 2 { rt.Args = append(rt.Args, [2]string{keyval[0], keyval[1]}) }