2021-11-01 16:42:48 -04:00
|
|
|
name: Linters and Tests
|
2021-06-18 15:08:33 -04:00
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
2021-11-30 02:35:07 -05:00
|
|
|
- master
|
|
|
|
types: [opened, synchronize, reopened, ready_for_review]
|
|
|
|
|
2021-06-18 15:08:33 -04:00
|
|
|
|
2021-11-07 04:22:59 -05:00
|
|
|
# This ensures that previous jobs for the PR are canceled when the PR is
|
2021-11-01 16:42:48 -04:00
|
|
|
# updated.
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-06-18 15:08:33 -04:00
|
|
|
jobs:
|
|
|
|
build:
|
2021-11-30 02:35:07 -05:00
|
|
|
if: github.event.pull_request.draft == false
|
2021-11-01 16:42:48 -04:00
|
|
|
name: Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
2021-06-18 15:08:33 -04:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-11-21 13:41:30 -05:00
|
|
|
go-version: [1.17.x]
|
2021-06-18 15:08:33 -04:00
|
|
|
os: [ubuntu-latest, windows-latest]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
2021-11-19 19:18:23 -05:00
|
|
|
- uses: actions/cache@v2
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-${{ matrix.go-version }}-go-
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
%LocalAppData%\go-build
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-${{ matrix.go-version }}-go-
|
2021-06-18 15:08:33 -04:00
|
|
|
- name: Build on ${{ matrix.os }}
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
env:
|
|
|
|
CGO_ENABLED: 0
|
|
|
|
GO111MODULE: on
|
|
|
|
run: |
|
|
|
|
go build --ldflags="-s -w" -o %GOPATH%\bin\minio.exe
|
|
|
|
go test -v --timeout 50m ./...
|
|
|
|
- name: Build on ${{ matrix.os }}
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
env:
|
|
|
|
CGO_ENABLED: 0
|
|
|
|
GO111MODULE: on
|
|
|
|
run: |
|
2021-07-17 04:17:35 -04:00
|
|
|
sudo apt install jq -y
|
2021-06-18 15:08:33 -04:00
|
|
|
sudo sysctl net.ipv6.conf.all.disable_ipv6=0
|
|
|
|
sudo sysctl net.ipv6.conf.default.disable_ipv6=0
|
|
|
|
nancy_version=$(curl --retry 10 -Ls -o /dev/null -w "%{url_effective}" https://github.com/sonatype-nexus-community/nancy/releases/latest | sed "s/https:\/\/github.com\/sonatype-nexus-community\/nancy\/releases\/tag\///")
|
|
|
|
curl -L -o nancy https://github.com/sonatype-nexus-community/nancy/releases/download/${nancy_version}/nancy-${nancy_version}-linux-amd64 && chmod +x nancy
|
2021-07-17 04:17:35 -04:00
|
|
|
go list -deps -json ./... | jq -s 'unique_by(.Module.Path)|.[]|select(has("Module"))|.Module' | ./nancy sleuth
|
2021-06-18 15:08:33 -04:00
|
|
|
make
|
2021-11-01 18:03:07 -04:00
|
|
|
make test
|
2021-06-18 15:08:33 -04:00
|
|
|
make test-race
|