diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/test.yaml index d91aa54..7c170b3 100644 --- a/.gitea/workflows/test.yaml +++ b/.gitea/workflows/test.yaml @@ -1,17 +1,72 @@ -name: 'Test Go Action' -on: [push] +name: testing +on: + - push + - pull_request + +env: + GOPATH: /go_path + GOCACHE: /go_cache + jobs: - use-go-action: + lint: + name: check and test runs-on: ubuntu-latest steps: - - name: Setup Go - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 with: - go-version: '1.20' + fetch-depth: 0 # all history for all branches and tags + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + check-latest: true + - uses: https://gitea.com/actions/go-hashfiles@v0.0.1 + id: hash-go + with: + patterns: | + go.mod + go.sum + - name: cache go + id: cache-go + uses: actions/cache@v4 + with: + path: | + /go_path + /go_cache + key: go_path-${{ steps.hash-go.outputs.hash }} + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.56.2 + args: --timeout 5m + testing: + name: check and test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # all history for all branches and tags - - name: Use Go Action - id: "test" - run: "go test ./..." - - - name: Print Output - run: echo 'output time is ${{ steps.test.outputs.time }}' \ No newline at end of file + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + check-latest: true + - uses: https://gitea.com/actions/go-hashfiles@v0.0.1 + id: hash-go + with: + patterns: | + go.mod + go.sum + - name: cache go + id: cache-go + uses: actions/cache@v4 + with: + path: | + /go_path + /go_cache + key: go_path-${{ steps.hash-go.outputs.hash }} + - name: build + run: go build ./... + - name: test + run: go test ./... \ No newline at end of file