Skip to content

Commit

Permalink
GitHub.action: go_test.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonSlovoka committed Sep 16, 2024
1 parent 3d3b71c commit ae648ec
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/go_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Go Test
on:
push:
branches-ignore:
- temp
pull_request:
branches-ignore:
- temp
defaults:
run:
working-directory: .
shell: pwsh
jobs:
test:
strategy:
matrix:
# [ubuntu-latest, macos-latest, windows-latest]
platform: [ windows-latest ]
go-version: [ 1.23.x ]
runs-on: ${{ matrix.platform }}
name: Integration tests
steps:
- name: Check out code into the Go module directory.
uses: actions/checkout@v4
- name: Install Go.
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
check-latest: true
cache-dependency-path: go.sum
cache: true

- name: go mod tidy
run: go mod tidy

- name: test All
run: go test -v -coverpkg=./... -coverprofile="coverage.txt" ./...

- name: Cover Func
run: go tool cover -func="coverage.txt"

- name: Upload coverage file
uses: actions/upload-artifact@v3
with:
name: coverage-artifact # go tool cover -html="coverage.txt"
path: ./coverage.txt # coverage.txt
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.exe
*.pdf
*.png
coverage.txt

# 此目錄由build.go所建立
bin/*

0 comments on commit ae648ec

Please sign in to comment.