Repository navigation
fix(lint): 修 Round 1 的 11 个 lint 报错 #9
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: Test (${{ matrix.os }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: 安装 mise 工具链 | |
| uses: jdx/mise-action@v2 | |
| with: | |
| experimental: true | |
| cache: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: 校验 go.mod | |
| shell: bash | |
| run: | | |
| mise exec -- go mod download | |
| mise exec -- go mod tidy | |
| changed=$(git status --porcelain -- go.mod go.sum) | |
| if [ -n "$changed" ]; then | |
| echo "go.mod / go.sum 存在未提交的变更:" | |
| echo "$changed" | |
| git --no-pager diff -- go.mod go.sum || true | |
| exit 1 | |
| fi | |
| - name: 单元测试 | |
| shell: bash | |
| run: mise run test | |
| - name: Lint | |
| if: runner.os == 'Linux' | |
| shell: bash | |
| run: mise run lint | |
| - name: 上传覆盖率 | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: coverage.out | |
| if-no-files-found: ignore | |
| build-matrix: | |
| name: Build ${{ matrix.goos }}/${{ matrix.goarch }} | |
| needs: test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| goos: [linux, darwin, windows] | |
| goarch: [amd64, arm64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: 交叉编译 | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: "0" | |
| run: | | |
| ext="" | |
| if [ "$GOOS" = "windows" ]; then ext=".exe"; fi | |
| go build -trimpath -ldflags="-s -w" -o "bin/std-ai-${GOOS}-${GOARCH}${ext}" . |