diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 9dfd7d6..96f5334 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -7,6 +7,52 @@ on: branches: [ master ] jobs: + test: + strategy: + matrix: + go-version: [1.13.x, 1.14.x] + platform: [ubuntu-latest] + runs-on: ${{ matrix.platform }} + steps: + - name: Install Go + if: success() + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v1 + - name: Run tests + run: | + go get -v -t -d ./... + go test -v -covermode=count + + coverage: + runs-on: ubuntu-latest + steps: + - name: Install Go + if: success() + uses: actions/setup-go@v1 + with: + go-version: 1.14.x + - name: Checkout code + uses: actions/checkout@v1 + - name: Calc coverage + run: | + export PATH=$PATH:$(go env GOPATH)/bin + go get -v -t -d ./... + go test -v . -covermode=count -coverprofile=coverage.out + # Required because the coverage.out file on github actions has a path that breaks gcov2lcov + sed -i "s/$(pwd|sed 's/\//\\\//g')/./g" coverage.out + - name: Convert coverage to lcov + uses: jandelgado/gcov2lcov-action@v1.0.0 + with: + infile: coverage.out + outfile: coverage.lcov + - name: Coveralls + uses: coverallsapp/github-action@v1.0.1 + with: + github-token: ${{ secrets.github_token }} + path-to-lcov: coverage.lcov build: name: Build @@ -32,6 +78,3 @@ jobs: - name: Build run: go build -v . - - - test: Test - run: go test -v .