workflow
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
name: Build and Test
|
||||
on:
|
||||
push:
|
||||
pull-request:
|
||||
- opened
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "1.20"
|
||||
- name: Cache Go modules
|
||||
id: cache-go
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
- name: Download Go modules
|
||||
shell: bash
|
||||
if: ${{ steps.cache-go.outputs.cache-hit != 'true' }}
|
||||
run: go mod download
|
||||
- name: Go build
|
||||
shell: bash
|
||||
run: go build ./...
|
||||
- name: Go test
|
||||
shell: bash
|
||||
run: go test ./...
|
||||
Reference in New Issue
Block a user