all: fix Github Workflow for tests, drop Travis
This commit is contained in:
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* text eol=lf
|
||||
16
.github/workflows/tests.yml
vendored
16
.github/workflows/tests.yml
vendored
@@ -18,15 +18,8 @@ jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
# Run most recent version of Go on all supported OSs.
|
||||
# When updating Go versions, also edit the version test in
|
||||
# internal/runtests.sh.
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
go-version: 1.17.x
|
||||
# Also run previous version of Go, but only on Ubuntu.
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
go-version: 1.16.x
|
||||
go-version: [1.17.x]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Install Go
|
||||
@@ -35,5 +28,8 @@ jobs:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Test
|
||||
run: './internal/runtests.sh'
|
||||
with:
|
||||
fetch-depth: 2 # required for codecov
|
||||
- name: Run Tests
|
||||
shell: bash
|
||||
run: 'internal/runtests.sh'
|
||||
|
||||
54
.travis.yml
54
.travis.yml
@@ -1,54 +0,0 @@
|
||||
# Copyright 2018 The Wire Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
language: go
|
||||
go_import_path: github.com/google/wire
|
||||
|
||||
before_install:
|
||||
# The Bash that comes with OS X is ancient.
|
||||
# grep is similar: it's not GNU grep, which means commands aren't portable.
|
||||
# Homebrew installs grep as ggrep if you don't build from source, so it needs
|
||||
# moving so it takes precedence in the PATH.
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install bash grep;
|
||||
mv $(brew --prefix)/bin/ggrep $(brew --prefix)/bin/grep;
|
||||
fi
|
||||
|
||||
install:
|
||||
# Re-checkout files preserving line feeds. This prevents Windows builds from
|
||||
# converting \n to \r\n.
|
||||
- "git config --global core.autocrlf input"
|
||||
- "git checkout -- ."
|
||||
|
||||
script:
|
||||
- 'internal/runtests.sh'
|
||||
|
||||
env:
|
||||
global:
|
||||
- GO111MODULE=on
|
||||
- GOPROXY=https://proxy.golang.org
|
||||
|
||||
jobs:
|
||||
# When updating Go versions:
|
||||
# In addition to changing the "go:" versions below, edit the version
|
||||
# test in ./internal/runtests.sh.
|
||||
include:
|
||||
- go: "1.15.x"
|
||||
os: linux
|
||||
- go: "1.16.x"
|
||||
os: linux
|
||||
- go: "1.16.x"
|
||||
os: osx
|
||||
- go: "1.16.x"
|
||||
os: windows
|
||||
@@ -12,6 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build wireinject
|
||||
// +build wireinject
|
||||
|
||||
// The build tag makes sure the stub is not built in the final build.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Code generated by Wire. DO NOT EDIT.
|
||||
|
||||
//go:generate go run github.com/google/wire/cmd/wire
|
||||
//go:build !wireinject
|
||||
// +build !wireinject
|
||||
|
||||
package main
|
||||
|
||||
@@ -24,7 +24,7 @@ fi
|
||||
# Run Go tests. Only do coverage for the Linux build
|
||||
# because it is slow, and codecov will only save the last one anyway.
|
||||
result=0
|
||||
if [[ "${TRAVIS_OS_NAME:-}" == "linux" ]]; then
|
||||
if [[ "${RUNNER_OS:-}" == "Linux" ]]; then
|
||||
echo "Running Go tests (with coverage)..."
|
||||
go test -mod=readonly -race -coverpkg=./... -coverprofile=coverage.out ./... || result=1
|
||||
if [ -f coverage.out ] && [ $result -eq 0 ]; then
|
||||
@@ -36,20 +36,11 @@ else
|
||||
fi
|
||||
|
||||
# No need to run other checks on OSs other than linux.
|
||||
# We default TRAVIS_OS_NAME to "linux" so that we don't abort here when run locally.
|
||||
if [[ "${TRAVIS_OS_NAME:-linux}" != "linux" ]]; then
|
||||
# We default RUNNER_OS to "Linux" so that we don't abort here when run locally.
|
||||
if [[ "${RUNNER_OS:-Linux}" != "Linux" ]]; then
|
||||
exit $result
|
||||
fi
|
||||
|
||||
# Update the regexp below when upgrading to a
|
||||
# new Go version. Some checks below we only run
|
||||
# for the latest Go version.
|
||||
latest_go_version=0
|
||||
if [[ $(go version) == *go1\.16* ]]; then
|
||||
latest_go_version=1
|
||||
fi
|
||||
|
||||
if [[ ${latest_go_version} -eq 1 ]]; then
|
||||
echo
|
||||
echo "Ensuring .go files are formatted with gofmt -s..."
|
||||
mapfile -t go_files < <(find . -name '*.go' -type f | grep -v testdata)
|
||||
@@ -61,7 +52,6 @@ if [[ ${latest_go_version} -eq 1 ]]; then
|
||||
else
|
||||
echo "OK"
|
||||
fi;
|
||||
fi;
|
||||
|
||||
|
||||
# Ensure that the code has no extra dependencies (including transitive
|
||||
@@ -69,7 +59,6 @@ fi;
|
||||
# ./internal/alldeps
|
||||
#
|
||||
# Whenever project dependencies change, rerun ./internal/listdeps.sh
|
||||
if [[ ${latest_go_version} -eq 1 ]]; then
|
||||
echo
|
||||
echo "Ensuring that there are no dependencies not listed in ./internal/alldeps..."
|
||||
(./internal/listdeps.sh | diff ./internal/alldeps - && echo "OK") || {
|
||||
@@ -78,12 +67,11 @@ if [[ ${latest_go_version} -eq 1 ]]; then
|
||||
echo "using the latest go version."
|
||||
result=1
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
# For pull requests, check if there are undeclared incompatible API changes.
|
||||
# Skip this if we're already going to fail since it is expensive.
|
||||
if [[ ${latest_go_version} -eq 1 ]] && [[ ${result} -eq 0 ]] && [[ ! -z "${TRAVIS_BRANCH:-x}" ]] && [[ ! -z "${TRAVIS_PULL_REQUEST_SHA:-x}" ]]; then
|
||||
if ${result} -eq 0 ]] && [[ ! -z "${GITHUB_HEAD_REF:-x}" ]]; then
|
||||
echo
|
||||
./internal/check_api_change.sh || result=1;
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user