Skip to content

Commit

Permalink
Add GitHub Actions Workflows + Dependabot configuration
Browse files Browse the repository at this point in the history
From 3650493.

Plus removal of the `go build` for the CLI.
  • Loading branch information
jamietanna committed Aug 28, 2023
1 parent 36e0405 commit f1d71be
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build project
on: [ push, pull_request ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'

- name: Test
run: make test
20 changes: 20 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Ensure generated files are up-to-date
on: [ push, pull_request ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'

- name: Run `make generate`
run: make generate

- name: Check for no untracked files
run: git status && git diff-index --quiet HEAD --
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint project
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'

- name: Run `make lint-ci`
run: make lint-ci
20 changes: 20 additions & 0 deletions .github/workflows/tidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Ensure `go mod tidy` has been run
on: [ push, pull_request ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'

- name: Install `tidied`
run: go install gitlab.com/jamietanna/tidied@latest

- name: Check for no untracked files
run: tidied -verbose
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
GOBASE=$(shell pwd)
GOBIN=$(GOBASE)/bin

help:
@echo "This is a helper makefile for oapi-codegen"
@echo "Targets:"
@echo " generate: regenerate all generated files"
@echo " test: run all tests"
@echo " gin_example generate gin example server code"
@echo " tidy tidy go mod"

$(GOBIN)/golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.54.0

.PHONY: tools
tools: $(GOBIN)/golangci-lint

lint: tools
$(GOBIN)/golangci-lint run ./...

lint-ci: tools
$(GOBIN)/golangci-lint run ./... --out-format=github-actions --timeout=5m

generate:
go generate ./...

test:
go test -cover ./...

tidy:
@echo "tidy..."
go mod tidy

0 comments on commit f1d71be

Please sign in to comment.