diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a78a06f27b9d2e974c2ea8cdab330dae99d3fd77..c0e9fe7e229d9d49fb8b80e4a928791d91f177f3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,9 +22,10 @@ reuse: extends: .reuse .go: - image: golang:latest + image: golang:$CI_GO_VERSION variables: GOPATH: /tmp/go + CI_GO_VERSION: "1.14" before_script: # Restore cache from place it is deposited to - mkdir -p $(go env GOPATH)/pkg/mod @@ -65,10 +66,13 @@ cross-build: matrix: - GOOS: linux GOARCH: ["386", amd64, arm, arm64, riscv64] + CI_GO_VERSION: ["1.14", "latest"] - GOOS: windows GOARCH: [amd64, arm64] + CI_GO_VERSION: ["latest"] - GOOS: darwin - GOARCH: [amd64, arm64] + CI_GO_VERSION: ["latest"] script: - GOOS=$GOOS GOARCH=$GOARCH go build ./... cache: @@ -81,6 +85,10 @@ unit-tests: needs: [static-checks] extends: .go stage: test + parallel: + matrix: + - GOOS: linux + CI_GO_VERSION: ["1.14", "latest"] before_script: - !reference [.go, before_script] # Install dbus-daemon and squashfs-tools which are used by dbus and @@ -88,7 +96,13 @@ unit-tests: # can just apt-get install it. - apt-get update && apt-get install -y dbus squashfs-tools # Install go package for emitting GitLab friendly coverage information. - - go install github.com/boumenot/gocover-cobertura@latest + - | + case "$CI_GO_VERSION" in + 1.14) + go get github.com/boumenot/gocover-cobertura ;; + latest) + go install github.com/boumenot/gocover-cobertura@latest ;; + esac script: - go test -coverprofile=coverage.txt -covermode count ./... - go tool cover -func=coverage.txt @@ -107,6 +121,11 @@ static-checks: interruptible: true needs: [spell, format] extends: .go + variables: + # Static checks should catch as much as we can, even at the price of running + # on the version of Go that is more recent than what the project promises as + # the required dependency. + CI_GO_VERSION: latest stage: static before_script: - !reference [.go, before_script]