Skip to content
Snippets Groups Projects
Commit d2d4aae3 authored by Zygmunt Krynicki's avatar Zygmunt Krynicki
Browse files

.gitlab-ci.yml: test against Go 1.14 and latest

SystemOTA tries to stay compatible with Yocto Dunfell which currently
provides Go 1.14. The test pipeline was following latest version of Go.
We should test against 1.14 and later versions equally.

Fixes: https://booting.oniroproject.org/distro/components/sysota/-/issues/57


Signed-off-by: default avatarZygmunt Krynicki <zygmunt.krynicki@huawei.com>
parent f38b7279
No related branches found
No related tags found
No related merge requests found
...@@ -22,9 +22,10 @@ reuse: ...@@ -22,9 +22,10 @@ reuse:
extends: .reuse extends: .reuse
.go: .go:
image: golang:latest image: golang:$CI_GO_VERSION
variables: variables:
GOPATH: /tmp/go GOPATH: /tmp/go
CI_GO_VERSION: "1.14"
before_script: before_script:
# Restore cache from place it is deposited to # Restore cache from place it is deposited to
- mkdir -p $(go env GOPATH)/pkg/mod - mkdir -p $(go env GOPATH)/pkg/mod
...@@ -65,10 +66,13 @@ cross-build: ...@@ -65,10 +66,13 @@ cross-build:
matrix: matrix:
- GOOS: linux - GOOS: linux
GOARCH: ["386", amd64, arm, arm64, riscv64] GOARCH: ["386", amd64, arm, arm64, riscv64]
CI_GO_VERSION: ["1.14", "latest"]
- GOOS: windows - GOOS: windows
GOARCH: [amd64, arm64] GOARCH: [amd64, arm64]
CI_GO_VERSION: ["latest"]
- GOOS: darwin - GOOS: darwin
- GOARCH: [amd64, arm64] - GOARCH: [amd64, arm64]
CI_GO_VERSION: ["latest"]
script: script:
- GOOS=$GOOS GOARCH=$GOARCH go build ./... - GOOS=$GOOS GOARCH=$GOARCH go build ./...
cache: cache:
...@@ -81,6 +85,10 @@ unit-tests: ...@@ -81,6 +85,10 @@ unit-tests:
needs: [static-checks] needs: [static-checks]
extends: .go extends: .go
stage: test stage: test
parallel:
matrix:
- GOOS: linux
CI_GO_VERSION: ["1.14", "latest"]
before_script: before_script:
- !reference [.go, before_script] - !reference [.go, before_script]
# Install dbus-daemon and squashfs-tools which are used by dbus and # Install dbus-daemon and squashfs-tools which are used by dbus and
...@@ -88,7 +96,13 @@ unit-tests: ...@@ -88,7 +96,13 @@ unit-tests:
# can just apt-get install it. # can just apt-get install it.
- apt-get update && apt-get install -y dbus squashfs-tools - apt-get update && apt-get install -y dbus squashfs-tools
# Install go package for emitting GitLab friendly coverage information. # 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: script:
- go test -coverprofile=coverage.txt -covermode count ./... - go test -coverprofile=coverage.txt -covermode count ./...
- go tool cover -func=coverage.txt - go tool cover -func=coverage.txt
...@@ -107,6 +121,11 @@ static-checks: ...@@ -107,6 +121,11 @@ static-checks:
interruptible: true interruptible: true
needs: [spell, format] needs: [spell, format]
extends: .go 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 stage: static
before_script: before_script:
- !reference [.go, before_script] - !reference [.go, before_script]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment