mirror of
https://github.com/kopia/kopia.git
synced 2026-05-24 14:44:47 -04:00
* ci: refactored CI/CD logic & Makefile - removed all travis CI emulation environment variables and replaced with: CI_TAG=<empty>|tag IS_PULL_REQUEST=false|true - refactored all OS and architecture-specific decisions to use around standard GOOS/GOARCH values instead of uname/OS - re-added self-hosted runner for ARMHF (3 replicas) - added brand new self-hosted runner for ARM64 (3 replicas) - disabled attempts to publish and sign on forks - improved integration test log output to better see timings and sub-tests - print longest tests (unit tests and integration) after each run - verified that all configurations build successfully on a clone (jkowalski/kopia) - run make setup in parallel * testing: fixed tests on ARM and ARM64 - fixed ARM-specific alignment issue - cleaned up test logging - fixed huge params warning threshold because it was tripping on ARM. - reduced test complexity to make them fit in 15 minutes
40 lines
946 B
Go
40 lines
946 B
Go
package testutil
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"runtime"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// TestSkipUnlessCI skips the current test with a provided message, except when running
|
|
// in CI environment, in which case it causes hard failure.
|
|
func TestSkipUnlessCI(t *testing.T, msg string, args ...interface{}) {
|
|
t.Helper()
|
|
|
|
if len(args) > 0 {
|
|
msg = fmt.Sprintf(msg, args...)
|
|
}
|
|
|
|
if os.Getenv("CI") != "" {
|
|
t.Fatal(msg)
|
|
} else {
|
|
t.Skip(msg)
|
|
}
|
|
}
|
|
|
|
// TestSkipOnCIUnlessLinuxAMD64 skips the current test if running on CI unless the environment is Linux/AMD64.
|
|
func TestSkipOnCIUnlessLinuxAMD64(t *testing.T) {
|
|
t.Helper()
|
|
|
|
if os.Getenv("CI") != "" && runtime.GOOS+"/"+runtime.GOARCH != "linux/amd64" {
|
|
t.Skip("test not supported in this environment.")
|
|
}
|
|
}
|
|
|
|
// ShouldReduceTestComplexity returns true if test complexity should be reduced on the current machine.
|
|
func ShouldReduceTestComplexity() bool {
|
|
return strings.Contains(runtime.GOARCH, "arm")
|
|
}
|