From 006a0d3c1fcf900548dbec1b81f25afe79e166a2 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 20 May 2018 22:07:05 +0900 Subject: [PATCH] run tests with -short flag on pull requests because they would fail since $GITHUB_TOKEN is not set --- .appveyor.yml | 16 ++++++++++++---- .travis.yml | 9 +++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 8027e28..cfe3063 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -15,9 +15,17 @@ test_script: - go build ./cmd/selfupdate-example - go build ./cmd/detect-latest-release - go build ./cmd/go-get-release/ - - go test -v -race -coverprofile=coverage.txt ./selfupdate + - ps: | + if (Test-Path env:GITHUB_TOKEN) { + go test -v -race -coverprofile=coverage.txt ./selfupdate + } else { + go test -v -race -short ./selfupdate + } after_test: - - "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%" - - pip install codecov - - codecov -f "coverage.txt" + - ps: | + if (Test-Path coverage.txt) { + "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%" + pip install codecov + codecov -f "coverage.txt" + } deploy: off diff --git a/.travis.yml b/.travis.yml index 359802c..d26837a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,11 @@ script: - go build ./cmd/selfupdate-example/ - go build ./cmd/detect-latest-release/ - go build ./cmd/go-get-release/ - - go test -v -race -coverprofile=coverage.txt ./selfupdate + - | + if [[ "${GITHUB_TOKEN}" != "" ]]; then + go test -v -race -coverprofile=coverage.txt ./selfupdate + else + go test -v -race -short ./selfupdate + fi after_success: - - bash <(curl -s https://codecov.io/bash) + - if [ -f coverage.txt ]; then bash <(curl -s https://codecov.io/bash); fi