Skip to content

Merge pull request #132 from miles170/dependabot/github_actions/codec… #306

Merge pull request #132 from miles170/dependabot/github_actions/codec…

Merge pull request #132 from miles170/dependabot/github_actions/codec… #306

Workflow file for this run

on:
push:
branches:
- main
pull_request:
branches:
- main
name: tests
env:
GO111MODULE: on
permissions:
contents: read
jobs:
test:
permissions:
actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows
contents: read # for actions/checkout to fetch code
strategy:
matrix:
go-version: [1.x, 1.19.x]
platform: [ubuntu-latest]
include:
# only update test coverage stats with the most recent go version on linux
- go-version: 1.x
platform: ubuntu-latest
update-coverage: true
runs-on: ${{ matrix.platform }}
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa #0.12.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Ensure go generate produces a zero diff
shell: bash
run: go generate -x ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code)
- name: Run go integration test
run: go test -v ./test/integration
- name: Run go test
run: go test -v -race -coverprofile coverage.txt ./twstock
- name: Upload coverage to Codecov
if: ${{ matrix.update-coverage }}
uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 #v3.1.5