From a70f15161506bfbb5a8594b23b45fa40d7cf1f2f Mon Sep 17 00:00:00 2001 From: hhs <386998068@qq.com> Date: Wed, 10 Jun 2026 10:58:43 +0800 Subject: [PATCH] =?UTF-8?q?perf(ci):=20=E5=90=AF=E7=94=A8=20Go=20=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E7=BC=93=E5=AD=98=EF=BC=8C=E7=BC=93=E5=AD=98=20golang?= =?UTF-8?q?ci-lint=20=E4=BA=8C=E8=BF=9B=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/go-loom.yaml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/go-loom.yaml b/.gitea/workflows/go-loom.yaml index afb62b9..10c4e77 100644 --- a/.gitea/workflows/go-loom.yaml +++ b/.gitea/workflows/go-loom.yaml @@ -22,15 +22,22 @@ jobs: uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} + cache: true - - name: Download dependencies - run: go mod download + - name: Cache golangci-lint + uses: actions/cache@v4 + with: + path: /usr/local/bin/golangci-lint + key: golangci-lint-${{ env.GOLANGCI_LINT_VERSION }} + + - name: Install golangci-lint + run: | + if [ ! -f /usr/local/bin/golangci-lint ]; then + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin ${{ env.GOLANGCI_LINT_VERSION }} + fi - name: Run golangci-lint - uses: golangci/golangci-lint-action@v4 - with: - version: ${{ env.GOLANGCI_LINT_VERSION }} - args: --timeout=5m --issues-exit-code=0 + run: golangci-lint run --timeout=5m --issues-exit-code=0 test: name: Test @@ -43,13 +50,10 @@ jobs: uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - - name: Download dependencies - run: go mod download + cache: true - name: Run tests run: | - # 跳过无测试文件的情况 test_files=$(find . -name "*_test.go" -type f) if [ -z "$test_files" ]; then echo "No test files found, skipping tests" @@ -76,9 +80,7 @@ jobs: uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - - name: Download dependencies - run: go mod download + cache: true - name: Build binary run: |