From 389db8f1da4a8832c4b35ad2425ce30f937b2db7 Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Fri, 29 Jan 2021 16:08:20 -0800 Subject: [PATCH] Update go build workflow to run with different go versions --- .github/workflows/go.yml | 53 ++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index e52964a..cf2b5cf 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,33 +1,50 @@ name: Go -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request] jobs: - build: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest] + go-version: [1.14.x, 1.15.x] + runs-on: ${{ matrix.os }} services: redis: image: redis ports: - 6379:6379 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.15 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} - - name: Build - run: go build -v ./... + - name: Build + run: go build -v ./... - - name: Test - run: go test -race -v ./... + - name: Test + run: go test -race -v -coverprofile=coverage.txt -covermode=atomic ./... - - name: Bench Test - run: go test -run=^$ -bench=. -loglevel=debug ./... + - name: Upload Test Results + uses: actions/upload-artifact@v2 + with: + name: test-results + path: test-results.txt + + - name: Upload Coverage + uses: actions/upload-artifact@v2 + with: + name: coverage + path: coverage.txt + + - name: Benchmark Test + run: go test -run=^$ -bench=. ./... | tee -a bench.txt + + - name: Upload Benchmark + uses: actions/upload-artifact@v2 + with: + name: bench-${{ matrix.os }}-${{ matrix.go-version }} + path: bench.txt