Prechádzať zdrojové kódy

travis: Deduplicate linter runs

Linters don't depend on the go version, they can run only once instead
of once per go version, simplifying the standard tests

Signed-off-by: Anatole Denis <anatole@unverle.fr>
Anatole Denis 5 rokov pred
rodič
commit
637d841e21
2 zmenil súbory, kde vykonal 10 pridanie a 28 odobranie
  1. 10 14
      .travis.yml
  2. 0 14
      .travis/linters.sh

+ 10 - 14
.travis.yml

@@ -3,6 +3,8 @@ language: go
 os: linux
 dist: bionic
 
+# The first element in this list will be the default for the non-matrix jobs,
+# so you usually want the latest version first
 go:
   - 1.14.x
   - 1.13.x
@@ -12,34 +14,28 @@ go:
 env:
   global:
     - GO111MODULE=on
-  matrix:
-    - TEST_SUITE=unit
-    - TEST_SUITE=linters
 
 before_install:
   - go get -t -v ./...
   - go get -t -v github.com/stretchr/testify/...
 
+# This is the script for the matrix tests (ran with each version of go)
 script: |
-  set -x
-  case $TEST_SUITE in
-  unit)
       ./.travis/setup-integ.sh
       ./.travis/tests.sh
-      ;;
-  linters)
-      ./.travis/linters.sh
-      ;;
-  *)
-      echo "[!] Unknown test suite: ${TEST_SUITE}. Exiting."
-      exit 1
-  esac
 
 after_success:
   - bash <(curl -s https://codecov.io/bash)
 
 
+# These are individual jobs unrelated to the matrix tests
 jobs:
   include:
     - name: Generator/main entrypoint drift
       script: ./.travis/check-generator-main.sh
+    - name: license headers
+      before_install: go get -u github.com/u-root/u-root/tools/checklicenses
+      script: checklicenses -c .travis/checklicenses_config.json
+    - name: golangci-lint
+      before_install: go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
+      script: golangci-lint run

+ 0 - 14
.travis/linters.sh

@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-
-go get github.com/golangci/golangci-lint/cmd/golangci-lint
-go install github.com/golangci/golangci-lint/cmd/golangci-lint
-golangci-lint run
-
-# check license headers
-# this needs to be run from the top level directory, because it uses
-# `git ls-files` under the hood.
-go get -u github.com/u-root/u-root/tools/checklicenses
-go install github.com/u-root/u-root/tools/checklicenses
-cd "${TRAVIS_BUILD_DIR}"
-echo "[*] Running checklicenses"
-go run github.com/u-root/u-root/tools/checklicenses -c .travis/checklicenses_config.json