git » spf » commit 622b60d

test: Replace Travis with GitLab CI integration

author Alberto Bertogli
2021-03-19 11:06:59 UTC
committer Alberto Bertogli
2021-03-19 11:39:50 UTC
parent 872f2efcc40cee57918bf74db655f8409838e66c

test: Replace Travis with GitLab CI integration

Travis for open source projects is being deprecated, so move to the
GitLab CI infrastructure.

.gitlab-ci.yml +25 -0
.travis.yml +0 -20
README.md +1 -1

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..0c53e35
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,25 @@
+# Configuration for the GitLab CI.
+
+# Go tests, on various Go versions.
+.golang_template: &golang
+  stage: test
+  script:
+    - go test ./...
+    - go test -race ./...
+
+golang_1.11:
+  <<: *golang
+  image: golang:1.11  # Oldest supported version (for now).
+
+golang_latest:
+  <<: *golang
+  image: golang:latest
+
+coverage:
+  <<: *golang
+  image: golang:latest
+  script:
+    - go test -covermode=count -coverprofile=coverage.out
+    - go get github.com/mattn/goveralls
+    - goveralls -coverprofile=coverage.out -service=gitlab -repotoken=$COVERALLS_TOKEN
+
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index a9a09a3..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-# Configuration for https://travis-ci.org/
-
-language: go
-dist: bionic
-
-go_import_path: blitiri.com.ar/go/spf
-
-go:
-    - 1.8
-    - stable
-    - master
-
-before_install:
-    - go get github.com/mattn/goveralls
-
-script:
-    - go test ./...
-    - go test -race ./...
-    - go test -v -covermode=count -coverprofile=coverage.out
-    - $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN
diff --git a/README.md b/README.md
index 5994ede..30dbe17 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
 # blitiri.com.ar/go/spf
 
 [![GoDoc](https://godoc.org/blitiri.com.ar/go/spf?status.svg)](https://pkg.go.dev/blitiri.com.ar/go/spf)
-[![Build Status](https://travis-ci.org/albertito/spf.svg?branch=master)](https://travis-ci.org/albertito/spf)
+[![Build Status](https://gitlab.com/albertito/spf/badges/master/pipeline.svg)](https://gitlab.com/albertito/spf/-/commits/master)
 [![Go Report Card](https://goreportcard.com/badge/github.com/albertito/spf)](https://goreportcard.com/report/github.com/albertito/spf)
 [![Coverage Status](https://coveralls.io/repos/github/albertito/spf/badge.svg?branch=next)](https://coveralls.io/github/albertito/spf)