mirror of
https://gitea.com/action-examples/Go.git
synced 2026-03-27 08:30:06 +00:00
ci: refactor GitHub Actions workflows and dependencies
- Rename GitHub Actions workflow file from `test.yml` to `testing.yml` - Change workflow job name from `checks` to `testing` - Update GitHub Actions `checkout` to version 4 - Remove specific Go version in favor of determining it from `go.mod` - Update GitHub Actions `setup-go` to version 5 - Update GitHub Actions `cache` to version 4 - Add `golangci-lint` action with specified version and timeout arguments Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
39
.gitea/workflows/testing.yml
Normal file
39
.gitea/workflows/testing.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
name: testing
|
||||
on:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
env:
|
||||
GOPATH: /go_path
|
||||
GOCACHE: /go_cache
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: check and test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # all history for all branches and tags
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: "go.mod"
|
||||
- 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
|
||||
Reference in New Issue
Block a user