mirror of
https://github.com/slackhq/nebula.git
synced 2025-11-08 23:03:58 +01:00
This PR does two things: - Only run the tests when relevant files change. - Cache the Go Modules directory between runs, so they don't have to redownload everything everytime (go.sum is the cache key). Pretty much straight from the examples: https://github.com/actions/cache/blob/master/examples.md#go---modules
33 lines
586 B
YAML
33 lines
586 B
YAML
name: gofmt
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
paths:
|
|
- '.github/workflows/gofmt.yml'
|
|
- '**.go'
|
|
jobs:
|
|
|
|
gofmt:
|
|
name: Run gofmt
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Set up Go 1.14
|
|
uses: actions/setup-go@v1
|
|
with:
|
|
go-version: 1.14
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v1
|
|
|
|
- name: gofmt
|
|
run: |
|
|
if [ "$(find . -iname '*.go' | xargs gofmt -l)" ]
|
|
then
|
|
find . -iname '*.go' | xargs gofmt -d
|
|
exit 1
|
|
fi
|