Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
go-daq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Gitlab has been updated. More info
here
.
Show more breadcrumbs
MIM
go-daq
Commits
edd9d8e1
Commit
edd9d8e1
authored
5 years ago
by
Sebastien Binet
Browse files
Options
Downloads
Patches
Plain Diff
ci: add travis ci infra
parent
5b94f81b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.travis.yml
+49
-0
49 additions, 0 deletions
.travis.yml
ci/run-tests.go
+123
-0
123 additions, 0 deletions
ci/run-tests.go
with
172 additions
and
0 deletions
.travis.yml
0 → 100644
+
49
−
0
View file @
edd9d8e1
language
:
go
go_import_path
:
github.com/go-lpc/mim
go
:
-
1.13.x
os
:
-
linux
arch
:
-
amd64
-
arm64
cache
:
directories
:
-
$HOME/.cache/go-build
-
$HOME/gopath/pkg/mod
git
:
depth
:
10
matrix
:
fast_finish
:
true
include
:
-
go
:
1.13.x
env
:
-
TAGS=""
-
COVERAGE="-coverpkg=github.com/go-lpc/mim/..."
-
go
:
master
env
:
-
TAGS=""
-
COVERAGE="-race"
sudo
:
required
notifications
:
email
:
recipients
:
-
binet@cern.ch
on_success
:
always
on_failure
:
always
script
:
-
go get -d -t -v ./...
-
go install -v $TAGS ./...
-
go run ./ci/run-tests.go $TAGS $COVERAGE
after_success
:
-
bash <(curl -s https://codecov.io/bash)
This diff is collapsed.
Click to expand it.
ci/run-tests.go
0 → 100644
+
123
−
0
View file @
edd9d8e1
// Copyright 2020 The go-lpc Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package
main
import
(
"bufio"
"bytes"
"flag"
"io/ioutil"
"log"
"os"
"os/exec"
"strings"
"time"
"golang.org/x/xerrors"
)
func
main
()
{
log
.
SetPrefix
(
"ci: "
)
log
.
SetFlags
(
0
)
start
:=
time
.
Now
()
defer
func
()
{
log
.
Printf
(
"elapsed time: %v
\n
"
,
time
.
Since
(
start
))
}()
var
(
race
=
flag
.
Bool
(
"race"
,
false
,
"enable race detector"
)
cover
=
flag
.
String
(
"coverpkg"
,
""
,
"apply coverage analysis in each test to packages matching the patterns."
)
tags
=
flag
.
String
(
"tags"
,
""
,
"build tags"
)
verbose
=
flag
.
Bool
(
"v"
,
false
,
"enable verbose output"
)
)
flag
.
Parse
()
pkgs
,
err
:=
pkgList
()
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
f
,
err
:=
os
.
Create
(
"coverage.txt"
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
defer
f
.
Close
()
args
:=
[]
string
{
"test"
}
if
*
verbose
||
*
cover
!=
""
||
*
race
{
args
=
append
(
args
,
"-v"
)
}
if
*
cover
!=
""
{
args
=
append
(
args
,
"-coverprofile=profile.out"
,
"-covermode=atomic"
,
"-coverpkg="
+*
cover
)
}
if
*
tags
!=
""
{
args
=
append
(
args
,
"-tags="
+*
tags
)
}
switch
{
case
*
race
:
args
=
append
(
args
,
"-race"
,
"-timeout=20m"
)
default
:
args
=
append
(
args
,
"-timeout=10m"
)
}
args
=
append
(
args
,
""
)
for
_
,
pkg
:=
range
pkgs
{
args
[
len
(
args
)
-
1
]
=
pkg
cmd
:=
exec
.
Command
(
"go"
,
args
...
)
cmd
.
Stdin
=
os
.
Stdin
cmd
.
Stdout
=
os
.
Stdout
cmd
.
Stderr
=
os
.
Stderr
err
:=
cmd
.
Run
()
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
if
*
cover
!=
""
{
profile
,
err
:=
ioutil
.
ReadFile
(
"profile.out"
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
_
,
err
=
f
.
Write
(
profile
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
os
.
Remove
(
"profile.out"
)
}
}
err
=
f
.
Close
()
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
}
func
pkgList
()
([]
string
,
error
)
{
out
:=
new
(
bytes
.
Buffer
)
cmd
:=
exec
.
Command
(
"go"
,
"list"
,
"./..."
)
cmd
.
Stdout
=
out
cmd
.
Stderr
=
os
.
Stderr
cmd
.
Stdin
=
os
.
Stdin
err
:=
cmd
.
Run
()
if
err
!=
nil
{
return
nil
,
xerrors
.
Errorf
(
"could not get package list: %w"
,
err
)
}
var
pkgs
[]
string
scan
:=
bufio
.
NewScanner
(
out
)
for
scan
.
Scan
()
{
pkg
:=
scan
.
Text
()
if
strings
.
Contains
(
pkg
,
"vendor"
)
{
continue
}
pkgs
=
append
(
pkgs
,
pkg
)
}
return
pkgs
,
nil
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment