From 954d703533d7ba9bd81cf18754e8c142e7bf1be2 Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Mon, 21 Nov 2022 18:18:39 +0200 Subject: [PATCH] ci: use check-cross-compile tool Change-Id: I2b858222c33eb0c9d1081ba8853a852ee14b32bd --- Jenkinsfile.premerge | 15 ++-- Jenkinsfile.public | 2 +- scripts/go-version-compatibility/main.go | 94 ------------------------ 3 files changed, 8 insertions(+), 103 deletions(-) delete mode 100644 scripts/go-version-compatibility/main.go diff --git a/Jenkinsfile.premerge b/Jenkinsfile.premerge index cd7eca537..413d1ef07 100644 --- a/Jenkinsfile.premerge +++ b/Jenkinsfile.premerge @@ -125,14 +125,13 @@ pipeline { } } - // TODO disabled temporarily - // stage('Cross Compile') { - // steps { - // // verify most of the commands, we cannot check everything since some of them - // // have a C dependency and we don't have cross-compilation in storj/ci image - // sh 'go run ./scripts/go-version-compatibility -parallel 4' - // } - // } + stage('Cross Compile') { + steps { + // verify most of the commands, we cannot check everything since some of them + // have a C dependency and we don't have cross-compilation in storj/ci image + sh 'check-cross-compile storj.io/storj/cmd/uplink storj.io/storj/cmd/satellite storj.io/storj/cmd/storagenode-updater storj.io/storj/cmd/storj-sim' + } + } stage('Check Benchmark') { environment { diff --git a/Jenkinsfile.public b/Jenkinsfile.public index d63b1cfbb..ea6f5a16a 100644 --- a/Jenkinsfile.public +++ b/Jenkinsfile.public @@ -151,7 +151,7 @@ pipeline { steps { // verify most of the commands, we cannot check everything since some of them // have a C dependency and we don't have cross-compilation in storj/ci image - sh 'go run ./scripts/go-version-compatibility -parallel 4' + sh 'check-cross-compile storj.io/storj/cmd/uplink storj.io/storj/cmd/satellite storj.io/storj/cmd/storagenode-updater storj.io/storj/cmd/storj-sim' } } stage('Tests') { diff --git a/scripts/go-version-compatibility/main.go b/scripts/go-version-compatibility/main.go deleted file mode 100644 index 5b0d88e01..000000000 --- a/scripts/go-version-compatibility/main.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (C) 2022 Storj Labs, Inc. -// See LICENSE for copying information. - -package main - -import ( - "context" - "flag" - "fmt" - "os" - "os/exec" - "runtime" - "strings" - - "storj.io/common/sync2" -) - -func main() { - parallel := flag.Int("parallel", runtime.GOMAXPROCS(0), "number of compiles to run in parallel") - flag.Parse() - - ctx := context.Background() - - type testcase struct { - compiler string - os string - arch string - } - - test := func(compiler, os, arch string) testcase { - return testcase{ - compiler: compiler, - os: os, - arch: arch, - } - } - - tests := []testcase{ - test("go", "linux", "amd64"), - test("go", "linux", "386"), - test("go", "linux", "arm64"), - test("go", "linux", "arm"), - test("go", "windows", "amd64"), - test("go", "windows", "386"), - test("go", "windows", "arm64"), - test("go", "darwin", "amd64"), - test("go", "darwin", "arm64"), - } - - type result struct { - title string - out string - err error - } - results := make([]result, len(tests)) - - lim := sync2.NewLimiter(*parallel) - for i, test := range tests { - i, test := i, test - lim.Go(ctx, func() { - cmd := exec.Command(test.compiler, "vet", - "storj.io/storj/cmd/uplink", - "storj.io/storj/cmd/satellite", - "storj.io/storj/cmd/storagenode-updater", - "storj.io/storj/cmd/storj-sim", - ) - cmd.Env = append(os.Environ(), - "GOOS="+test.os, - "GOARCH="+test.arch, - ) - - data, err := cmd.CombinedOutput() - results[i] = result{ - title: test.compiler + "/" + test.os + "/" + test.arch, - out: strings.TrimSpace(string(data)), - err: err, - } - }) - } - lim.Wait() - - exit := 0 - for _, r := range results { - if r.err == nil { - fmt.Println("#", r.title, "SUCCESS") - } else { - fmt.Println("#", r.title, "FAILED", r.err) - fmt.Println(r.out) - fmt.Println() - exit = 1 - } - } - os.Exit(exit) -}