ci: add GitHub Actions workflow for linting and caching Go dependencies
- Add a new file `.gitea/workflows/test.yml` - Set up a workflow named `checks` - Trigger the workflow on `push` and `pull_request` - Set environment variables `GOPATH` and `GOCACHE` - Define a job named `lint` that runs on `ubuntu-latest` - Add steps to the `lint` job, including checking out the code, setting up Go, and caching Go dependencies Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
parent
9dfe08a58c
commit
52993a9e36
|
@ -0,0 +1,32 @@
|
||||||
|
name: checks
|
||||||
|
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@v3
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '>=1.20.1'
|
||||||
|
- 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: https://github.com/actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
/go_path
|
||||||
|
/go_cache
|
||||||
|
key: go_path-${{ steps.hash-go.outputs.hash }}
|
Loading…
Reference in New Issue