travis: check for copyright headers

This commit is contained in:
Dan Kortschak
2018-09-05 16:54:43 +09:30
committed by GitHub
parent 70492dcef1
commit 36be7e6faa
8 changed files with 29 additions and 16 deletions

View File

@@ -26,6 +26,8 @@ before_install:
- go get golang.org/x/tools/cmd/goimports
# Required for imports check.
- go get gonum.org/v1/tools/cmd/check-imports
# Required for copyright header check.
- go get gonum.org/v1/tools/cmd/check-copyright
# Required for coverage.
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
@@ -37,6 +39,7 @@ go_import_path: gonum.org/v1/gonum
# Get deps, build, test, and ensure the code is gofmt'ed.
# If we are building as gonum, then we have access to the coveralls api key, so we can run coverage as well.
script:
- ${TRAVIS_BUILD_DIR}/.travis/check-copyright.sh
- ${TRAVIS_BUILD_DIR}/.travis/check-formatting.sh
- go get -d -t -v ./...
- go build -v ./...

4
.travis/check-copyright.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
set -e
check-copyright -notice "Copyright ©20[0-9]{2} The Gonum Authors\. All rights reserved\."

View File

@@ -1,6 +1,6 @@
// Code generated by "go run github.com/gonum/blas/testblas/benchautogen/autogen_bench_level1double.go"; DO NOT EDIT.
// Code generated by "go run gonum.org/v1/gonum/blas/testblas/benchautogen/autogen_bench_level1double.go"; DO NOT EDIT.
// Copyright 2014 The Gonum Authors. All rights reserved.
// Copyright ©2014 The Gonum Authors. All rights reserved.
// Use of this code is governed by a BSD-style
// license that can be found in the LICENSE file

View File

@@ -1,4 +1,4 @@
// Copyright 2014 The Gonum Authors. All rights reserved.
// Copyright ©2014 The Gonum Authors. All rights reserved.
// Use of this code is governed by a BSD-style
// license that can be found in the LICENSE file
@@ -9,14 +9,13 @@ import (
"fmt"
"os"
"os/exec"
"path"
"path/filepath"
"strconv"
)
var gopath string
var copyrightnotice = []byte(`// Copyright 2014 The Gonum Authors. All rights reserved.
var copyrightnotice = []byte(`// Copyright ©2014 The Gonum Authors. All rights reserved.
// Use of this code is governed by a BSD-style
// license that can be found in the LICENSE file`)
@@ -180,18 +179,16 @@ func init() {
}
func main() {
blasPath := filepath.Join(gopath, "src", "gonum.org", "v1", "gonum", "blas")
pkgs := []struct{ name string }{{name: "native"}, {name: "cgo"}}
pkgs := []string{"gonum", "netlib"}
for _, pkg := range pkgs {
err := level1(filepath.Join(blasPath, pkg.name), pkg.name)
blasPath := filepath.Join(gopath, "src", "gonum.org", "v1", pkg, "blas", pkg)
err := level1(blasPath, pkg)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
err = exec.Command("go", "fmt", path.Join("gonum.org", "v1", "gonum", "blas", pkg.name)).Run()
err = exec.Command("goimports", "-w", blasPath).Run()
if err != nil {
fmt.Println(err)
os.Exit(1)
@@ -219,8 +216,7 @@ func level1(benchPath string, pkgname string) error {
level1Filepath := filepath.Join(benchPath, "level1doubleBench_auto_test.go")
f, err := os.Create(level1Filepath)
if err != nil {
fmt.Println(err)
os.Exit(1)
return err
}
defer f.Close()
printHeader(f, pkgname)

View File

@@ -1,4 +1,4 @@
// Copyright 2013 The Gonum Authors. All rights reserved.
// Copyright ©2013 The Gonum Authors. All rights reserved.
// Use of this code is governed by a BSD-style
// license that can be found in the LICENSE file

View File

@@ -1,4 +1,4 @@
// Copyright 2013 The Gonum Authors. All rights reserved.
// Copyright ©2013 The Gonum Authors. All rights reserved.
// Use of this code is governed by a BSD-style
// license that can be found in the LICENSE file

View File

@@ -1,4 +1,4 @@
// Copyright 2013 The Gonum Authors. All rights reserved.
// Copyright ©2013 The Gonum Authors. All rights reserved.
// Use of this code is governed by a BSD-style
// license that can be found in the LICENSE file

View File

@@ -1,3 +1,13 @@
// This file is dual licensed under CC0 and The gonum license.
//
// Copyright ©2017 The Gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// Copyright ©2017 Robin Eklind.
// This file is made available under a Creative Commons CC0 1.0
// Universal Public Domain Dedication.`)
// +build ignore
package main