From 1db7a3bbed28b613f7936edc7a4e16ed49d16fa9 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 19 Sep 2019 17:26:49 -0700 Subject: [PATCH] Add go.yml github workflow (#2902) --- .github/workflows/go.yml | 43 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 38 ----------------------------------- 2 files changed, 43 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/go.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 00000000..0f06e9fc --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,43 @@ +name: Go + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + build: + name: Test on Go ${{ matrix.go-version }} and ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + go-version: [1.13.x] + os: [ubuntu-latest, windows-latest] + steps: + - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go-version }} + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v1 + + - name: Build on ${{ matrix.os }} + if: matrix.os == 'windows-latest' + env: + GO111MODULE: on + run: go test -v -race ./... + - name: Build on ${{ matrix.os }} + if: matrix.os == 'ubuntu-latest' + env: + GO111MODULE: on + run: | + diff -au <(gofmt -d *.go) <(printf "") + diff -au <(gofmt -d cmd) <(printf "") + diff -au <(gofmt -d pkg) <(printf "") + go test -v -race ./... + make test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 66b6a365..00000000 --- a/.travis.yml +++ /dev/null @@ -1,38 +0,0 @@ -go_import_path: github.com/minio/mc - -language: go - -# this ensures PRs based on a local branch are not built twice -# the downside is that a PR targeting a different branch is not built -# but as a workaround you can add the branch to this list -branches: - only: - - master - -matrix: - include: - - os: linux - dist: trusty - env: - - ARCH=x86_64 - - GO111MODULE=on - go: 1.13.x - script: - - diff -au <(gofmt -d *.go) <(printf "") - - diff -au <(gofmt -d cmd) <(printf "") - - diff -au <(gofmt -d pkg) <(printf "") - - for d in $(go list ./...); do go test -v -race "$d"; done - - make verifiers - - os: windows - env: - - ARCH=x86_64 - - GO111MODULE=on - go: 1.13 - script: - - go build --ldflags="$(go run buildscripts/gen-ldflags.go)" -o %GOPATH%\bin\mc.exe - - for d in $(go list ./...); do go test -v -race "$d"; done - -before_script: - # Add an IPv6 config - see the corresponding Travis issue - # https://github.com/travis-ci/travis-ci/issues/8361 - - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'; fi