Improve workflows (#98)

Starting from setup-go v4, it will cache build dependencies by default, see https://github.com/actions/setup-go#caching-dependency-files-and-build-outputs.

Also bump some versions.

Reviewed-on: https://gitea.com/gitea/act/pulls/98
This commit is contained in:
Jason Song 2024-03-14 10:30:05 +00:00
parent 2b860ce371
commit a28ebf0a48
No known key found for this signature in database
GPG Key ID: 8402EEEE4511A8B5
1 changed files with 5 additions and 28 deletions

View File

@ -3,42 +3,19 @@ on:
- push
- pull_request
env:
GOPROXY: https://goproxy.io,direct
GOPATH: /go_path
GOCACHE: /go_cache
jobs:
lint:
name: check and test
runs-on: ubuntu-latest
steps:
- name: cache go path
id: cache-go-path
uses: https://github.com/actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
path: /go_path
key: go_path-${{ github.repository }}-${{ github.ref_name }}
restore-keys: |
go_path-${{ github.repository }}-
go_path-
- name: cache go cache
id: cache-go-cache
uses: https://github.com/actions/cache@v3
with:
path: /go_cache
key: go_cache-${{ github.repository }}-${{ github.ref_name }}
restore-keys: |
go_cache-${{ github.repository }}-
go_cache-
- uses: actions/setup-go@v3
with:
go-version: 1.20
- uses: actions/checkout@v3
go-version-file: 'go.mod'
- name: vet checks
run: go vet -v ./...
- name: build
run: go build -v ./...
- name: test
run: go test -v ./pkg/jobparser
# TODO test more packages
run: | # Test only the new packages in this fork. Add more packages as needed.
go test -v ./pkg/jobparser