From 3bc552068edeb8981a0ee2e308d60aa10f17bea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20Soul=C3=A9?= Date: Sun, 8 Nov 2020 22:33:47 +0100 Subject: [PATCH] test: Build action now uses maxatome/install-go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime Soulé --- .github/workflows/ci.yml | 46 +++++++++++----------------------------- 1 file changed, 12 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7db895b..92e2b1a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,29 +22,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Go version + - name: Setup go run: | - if [ ${{ matrix.go-version }} = tip ]; then - version=$GO_CURRENT - echo "Using gotip via go $version" - else - version=${{ matrix.go-version }} - echo "Using go $version" - fi - go version - echo ::set-output name=go_version::$version - - - name: Install go - uses: actions/setup-go@v2 - with: - go-version: ${{ steps.vars.outputs.go_version }} - - - name: Install gotip - if: matrix.go-version == 'tip' - continue-on-error: true - run: | - go get golang.org/dl/gotip - $(go env GOPATH)/bin/gotip download + curl -sL https://raw.githubusercontent.com/maxatome/install-go/env/install-go.pl | + perl - ${{ matrix.go-version }} $HOME/go - name: Checkout code uses: actions/checkout@v2 @@ -52,42 +33,39 @@ jobs: - name: Linting if: matrix.full-tests run: | - mkdir /tmp/linter-bin wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | - sh -s -- -b /tmp/linter-bin v1.30.0 - /tmp/linter-bin/golangci-lint run -E gofmt -E golint -E maligned -E misspell -E prealloc -E unconvert -E whitespace -E goimports ./... + sh -s -- -b $HOME/go/bin v1.33.0 + echo $PATH + $HOME/go/bin/golangci-lint run -E gofmt -E golint -E maligned -E misspell -E prealloc -E unconvert -E whitespace -E goimports ./... - name: Testing continue-on-error: ${{ matrix.go-version == 'tip' }} run: | + go version if [ ${{ matrix.full-tests }} = true ]; then GO_TEST_SAFE_FLAGS="-covermode=atomic -coverprofile=coverage-safe.out" GO_TEST_UNSAFE_FLAGS="-covermode=atomic -coverprofile=coverage-unsafe.out" fi - PATH=$PATH:$(go env GOPATH)/bin - go=go case ${{ matrix.go-version }} in - tip) go=gotip ;; 1.9.x | 1.10.x) # Before go 1.11, go modules are not available mkdir -p ../src/github.com/maxatome - ln -s $(pwd) ../src/github.com/maxatome/go-testdeep + ln -s $(pwd) ../src/github.com/$GITHUB_REPOSITORY export GOPATH=$(dirname $(pwd)) - cd $GOPATH/src/github.com/maxatome/go-testdeep + cd $GOPATH/src/github.com/$GITHUB_REPOSITORY ;; esac export GORACE="halt_on_error=1" - $go get -t ./... - $go test -race -tags safe $GO_TEST_SAFE_FLAGS ./... - $go test -race $GO_TEST_UNSAFE_FLAGS ./... + go get -t ./... + go test -race -tags safe $GO_TEST_SAFE_FLAGS ./... + go test -race $GO_TEST_UNSAFE_FLAGS ./... - name: Reporting if: matrix.full-tests env: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - PATH=$PATH:$(go env GOPATH)/bin go get github.com/mattn/goveralls go get github.com/wadey/gocovmerge gocovmerge coverage-safe.out coverage-unsafe.out > coverage.out