refactor: 优化构建流程并压缩二进制文件 #39
This file contains hidden or 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
| name: Unit-Tests | |
| on: | |
| pull_request: | |
| paths: | |
| - 'go.mod' | |
| - '**.go' | |
| - '**.yml' | |
| push: | |
| paths: | |
| - 'go.mod' | |
| - '**.go' | |
| - '**.yml' | |
| jobs: | |
| test: | |
| name: Test on go ${{ matrix.go_version }} and ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| go_version: [1.25, stable] | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| - name: Setup Go Faster | |
| uses: WillAbides/setup-go-faster@v1.15.0 | |
| timeout-minutes: 3 | |
| with: | |
| go-version: ${{ matrix.go_version }} | |
| - name: Run staticcheck | |
| uses: reviewdog/action-staticcheck@v1 | |
| if: ${{ matrix.os == 'ubuntu-latest' && matrix.go_version == 'stable' }} | |
| with: | |
| github_token: ${{ secrets.github_token }} | |
| # Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review]. | |
| reporter: github-check | |
| # Report all results. [added,diff_context,file,nofilter]. | |
| filter_mode: added | |
| # Exit with 1 when it finds at least one finding. | |
| fail_level: 'none' | |
| - name: Mod tidy | |
| run: | | |
| go mod tidy | |
| - name: Run unit tests | |
| # run: go test -v -cover ./... | |
| # must add " for profile.cov on Windows OS | |
| run: | | |
| go test -coverprofile="profile.cov" ./... |