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: |