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:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
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]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
go-version: 1.17.x
|
go-version: [1.17.x]
|
||||||
# Also run previous version of Go, but only on Ubuntu.
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
go-version: 1.16.x
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
@@ -35,5 +28,8 @@ jobs:
|
|||||||
go-version: ${{ matrix.go-version }}
|
go-version: ${{ matrix.go-version }}
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Test
|
with:
|
||||||
run: './internal/runtests.sh'
|
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,7 +12,8 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//+build wireinject
|
//go:build wireinject
|
||||||
|
// +build wireinject
|
||||||
|
|
||||||
// The build tag makes sure the stub is not built in the final build.
|
// The build tag makes sure the stub is not built in the final build.
|
||||||
package main
|
package main
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
// Code generated by Wire. DO NOT EDIT.
|
// Code generated by Wire. DO NOT EDIT.
|
||||||
|
|
||||||
//go:generate go run github.com/google/wire/cmd/wire
|
//go:generate go run github.com/google/wire/cmd/wire
|
||||||
//+build !wireinject
|
//go:build !wireinject
|
||||||
|
// +build !wireinject
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ fi
|
|||||||
# Run Go tests. Only do coverage for the Linux build
|
# Run Go tests. Only do coverage for the Linux build
|
||||||
# because it is slow, and codecov will only save the last one anyway.
|
# because it is slow, and codecov will only save the last one anyway.
|
||||||
result=0
|
result=0
|
||||||
if [[ "${TRAVIS_OS_NAME:-}" == "linux" ]]; then
|
if [[ "${RUNNER_OS:-}" == "Linux" ]]; then
|
||||||
echo "Running Go tests (with coverage)..."
|
echo "Running Go tests (with coverage)..."
|
||||||
go test -mod=readonly -race -coverpkg=./... -coverprofile=coverage.out ./... || result=1
|
go test -mod=readonly -race -coverpkg=./... -coverprofile=coverage.out ./... || result=1
|
||||||
if [ -f coverage.out ] && [ $result -eq 0 ]; then
|
if [ -f coverage.out ] && [ $result -eq 0 ]; then
|
||||||
@@ -36,31 +36,21 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# No need to run other checks on OSs other than linux.
|
# 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.
|
# We default RUNNER_OS to "Linux" so that we don't abort here when run locally.
|
||||||
if [[ "${TRAVIS_OS_NAME:-linux}" != "linux" ]]; then
|
if [[ "${RUNNER_OS:-Linux}" != "Linux" ]]; then
|
||||||
exit $result
|
exit $result
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update the regexp below when upgrading to a
|
echo
|
||||||
# new Go version. Some checks below we only run
|
echo "Ensuring .go files are formatted with gofmt -s..."
|
||||||
# for the latest Go version.
|
mapfile -t go_files < <(find . -name '*.go' -type f | grep -v testdata)
|
||||||
latest_go_version=0
|
DIFF="$(gofmt -s -d "${go_files[@]}")"
|
||||||
if [[ $(go version) == *go1\.16* ]]; then
|
if [ -n "$DIFF" ]; then
|
||||||
latest_go_version=1
|
echo "FAIL: please run gofmt -s and commit the result"
|
||||||
fi
|
echo "$DIFF";
|
||||||
|
result=1;
|
||||||
if [[ ${latest_go_version} -eq 1 ]]; then
|
else
|
||||||
echo
|
echo "OK"
|
||||||
echo "Ensuring .go files are formatted with gofmt -s..."
|
|
||||||
mapfile -t go_files < <(find . -name '*.go' -type f | grep -v testdata)
|
|
||||||
DIFF="$(gofmt -s -d "${go_files[@]}")"
|
|
||||||
if [ -n "$DIFF" ]; then
|
|
||||||
echo "FAIL: please run gofmt -s and commit the result"
|
|
||||||
echo "$DIFF";
|
|
||||||
result=1;
|
|
||||||
else
|
|
||||||
echo "OK"
|
|
||||||
fi;
|
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
|
||||||
@@ -69,21 +59,19 @@ fi;
|
|||||||
# ./internal/alldeps
|
# ./internal/alldeps
|
||||||
#
|
#
|
||||||
# Whenever project dependencies change, rerun ./internal/listdeps.sh
|
# Whenever project dependencies change, rerun ./internal/listdeps.sh
|
||||||
if [[ ${latest_go_version} -eq 1 ]]; then
|
echo
|
||||||
echo
|
echo "Ensuring that there are no dependencies not listed in ./internal/alldeps..."
|
||||||
echo "Ensuring that there are no dependencies not listed in ./internal/alldeps..."
|
(./internal/listdeps.sh | diff ./internal/alldeps - && echo "OK") || {
|
||||||
(./internal/listdeps.sh | diff ./internal/alldeps - && echo "OK") || {
|
echo "FAIL: dependencies changed; run: internal/listdeps.sh > internal/alldeps"
|
||||||
echo "FAIL: dependencies changed; run: internal/listdeps.sh > internal/alldeps"
|
# Module behavior may differ across versions.
|
||||||
# Module behavior may differ across versions.
|
echo "using the latest go version."
|
||||||
echo "using the latest go version."
|
result=1
|
||||||
result=1
|
}
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# For pull requests, check if there are undeclared incompatible API changes.
|
# For pull requests, check if there are undeclared incompatible API changes.
|
||||||
# Skip this if we're already going to fail since it is expensive.
|
# 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
|
echo
|
||||||
./internal/check_api_change.sh || result=1;
|
./internal/check_api_change.sh || result=1;
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user