Split-out CI steps into stand-alone scripts
This commit is contained in:
@@ -7,7 +7,7 @@ run:
|
|||||||
# concurrency: 4
|
# concurrency: 4
|
||||||
|
|
||||||
# timeout for analysis, e.g. 30s, 5m, default is 1m
|
# timeout for analysis, e.g. 30s, 5m, default is 1m
|
||||||
deadline: 1m
|
deadline: 2m
|
||||||
|
|
||||||
# exit code when at least one issue was found, default is 1
|
# exit code when at least one issue was found, default is 1
|
||||||
issues-exit-code: 1
|
issues-exit-code: 1
|
||||||
|
|||||||
72
.travis.yml
72
.travis.yml
@@ -1,64 +1,48 @@
|
|||||||
language: go
|
language: go
|
||||||
go_import_path: github.com/42wim/matterbridge
|
go_import_path: github.com/42wim/matterbridge
|
||||||
|
|
||||||
# we have everything vendored
|
# We have everything vendored so this helps TravisCI not run `go get ...`.
|
||||||
install: true
|
install: true
|
||||||
|
|
||||||
git:
|
git:
|
||||||
depth: 200
|
depth: 200
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email: false
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
notifications:
|
jobs:
|
||||||
email: false
|
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- GOOS=linux GOARCH=amd64
|
|
||||||
- GO111MODULE=on
|
|
||||||
- GOLANGCI_VERSION="v1.15.0"
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
include:
|
||||||
- go: 1.11.x
|
- stage: lint
|
||||||
env: GO111MODULE=off
|
# Run linting in one Go environment only.
|
||||||
- go: 1.11.x
|
script: ./ci/lint.sh
|
||||||
env: GO111MODULE=on
|
go: 1.12.x
|
||||||
- go: 1.12.x
|
env:
|
||||||
env: GO111MODULE=on
|
- GO111MODULE=on
|
||||||
|
- GOLANGCI_VERSION="v1.15.0"
|
||||||
before_script:
|
- stage: test
|
||||||
# Get version info from tags.
|
# Run tests in a combination of Go environments.
|
||||||
- MY_VERSION="$(git describe --tags)"
|
script: ./ci/test.sh
|
||||||
# Retrieve the golangci-lint linter binary.
|
go: 1.11.x
|
||||||
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b ${GOPATH}/bin ${GOLANGCI_VERSION}
|
env:
|
||||||
# Retrieve and prepare CodeClimate's test coverage reporter.
|
- GO111MODULE=off
|
||||||
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
- script: ./ci/test.sh
|
||||||
- chmod +x ./cc-test-reporter
|
go: 1.11.x
|
||||||
- ./cc-test-reporter before-build
|
env:
|
||||||
|
- GO111MODULE=on
|
||||||
script:
|
- script: ./ci/test.sh
|
||||||
# Ensure that the module files are being kept correctly and that vendored dependencies are up-to-date.
|
go: 1.12.x
|
||||||
- go mod tidy
|
env:
|
||||||
- go mod vendor
|
- GO111MODULE=on
|
||||||
- git diff --exit-code --quiet || (echo "Please run 'go mod tidy' to clean up the 'go.mod' and 'go.sum' files."; false)
|
- REPORT_COVERAGE=1
|
||||||
|
|
||||||
# Run the linter.
|
|
||||||
- golangci-lint run
|
|
||||||
|
|
||||||
# Run all the tests with the race detector and generate coverage.
|
|
||||||
- go test -v -race -coverprofile c.out ./...
|
|
||||||
|
|
||||||
after_script:
|
|
||||||
# Upload test coverage to CodeClimate.
|
|
||||||
- ./cc-test-reporter after-build --exit-code ${TRAVIS_TEST_RESULT}
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
on:
|
on:
|
||||||
all_branches: true
|
all_branches: true
|
||||||
condition: env(TRAVIS_GO_VERSION) = 1.12.x
|
condition: env(TRAVIS_GO_VERSION) = 1.12.x AND env(GO111MODULE) = on
|
||||||
before_deploy:
|
before_deploy:
|
||||||
# Run the build script to generate the necessary binaries and images.
|
# Run the build script to generate the necessary binaries and images.
|
||||||
- /bin/bash ci/bintray.sh
|
- /bin/bash ci/bintray.sh
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -u -e -x -o pipefail
|
set -u -e -x -o pipefail
|
||||||
|
|
||||||
go version | grep go1.12 || exit
|
go version | grep go1.12 || exit
|
||||||
|
|||||||
17
ci/lint.sh
Executable file
17
ci/lint.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -u -e -x -o pipefail
|
||||||
|
|
||||||
|
if [[ -n "${GOLANGCI_VERSION-}" ]]; then
|
||||||
|
# Retrieve the golangci-lint linter binary.
|
||||||
|
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b ${GOPATH}/bin ${GOLANGCI_VERSION}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the linter.
|
||||||
|
golangci-lint run
|
||||||
|
|
||||||
|
if [[ "${GO111MODULE-off}" == "on" ]]; then
|
||||||
|
# If Go modules are active then check that dependencies are correctly maintained.
|
||||||
|
go mod tidy
|
||||||
|
go mod vendor
|
||||||
|
git diff --exit-code --quiet || (echo "Please run 'go mod tidy' to clean up the 'go.mod' and 'go.sum' files."; false)
|
||||||
|
fi
|
||||||
17
ci/test.sh
Executable file
17
ci/test.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -u -e -x -o pipefail
|
||||||
|
|
||||||
|
if [[ -n "${REPORT_COVERAGE+cover}" ]]; then
|
||||||
|
# Retrieve and prepare CodeClimate's test coverage reporter.
|
||||||
|
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
||||||
|
chmod +x ./cc-test-reporter
|
||||||
|
./cc-test-reporter before-build
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run all the tests with the race detector and generate coverage.
|
||||||
|
go test -v -race -coverprofile c.out ./...
|
||||||
|
|
||||||
|
if [[ -n "${REPORT_COVERAGE+cover}" && "${TRAVIS_SECURE_ENV_VARS}" == "true" ]]; then
|
||||||
|
# Upload test coverage to CodeClimate.
|
||||||
|
./cc-test-reporter after-build
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user