Merge pull request #231 from miles170/cron-generate-securities-list #520
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
name: tests | |
env: | |
GO111MODULE: on | |
concurrency: | |
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
permissions: | |
contents: read | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: [1.x, 1.23.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: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- uses: actions/checkout@v4 | |
# Get values for cache paths to be used in later steps | |
- id: cache-paths | |
run: | | |
echo "go-cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT | |
echo "go-mod-cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT | |
- name: Cache go modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ steps.cache-paths.outputs.go-cache }} | |
${{ steps.cache-paths.outputs.go-mod-cache }} | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-go | |
- 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 test | |
run: go test -v -race -covermode atomic -coverprofile coverage.txt ./twstock | |
- name: Run go integration test | |
run: go test -p 1 -v ./test/integration | |
- name: Upload coverage to Codecov | |
if: ${{ matrix.update-coverage }} | |
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 #v5.1.2 |