ci: use check-cross-compile tool

Change-Id: I2b858222c33eb0c9d1081ba8853a852ee14b32bd
This commit is contained in:
Egon Elbre 2022-11-21 18:18:39 +02:00
parent 8e9b7736cc
commit 954d703533
3 changed files with 8 additions and 103 deletions

View File

@ -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 {

View File

@ -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') {

View File

@ -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)
}