Files
docker-state-exporter/.github/workflows/build.yml
T
2024-08-04 04:50:10 +09:00

35 lines
851 B
YAML

name: Build and Test
on:
push:
pull-request:
- opened
branches:
- main
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Cache Go modules
id: cache-go
uses: actions/cache@v4
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 ./...