Skip to content

Commit ec26011

Browse files
committed
Add GitHub Actions Workflows + Renovate configuration
Via oapi-codegen/runtime@98a1845.
1 parent 10fd483 commit ec26011

File tree

7 files changed

+157
-0
lines changed

7 files changed

+157
-0
lines changed

Diff for: .github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @oapi-codegen/maintainers

Diff for: .github/workflows/ci.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build project
2+
on: [ push, pull_request ]
3+
jobs:
4+
build:
5+
name: Build
6+
runs-on: ubuntu-latest
7+
strategy:
8+
fail-fast: false
9+
# perform matrix testing to give us an earlier insight into issues with different versions of supported major versions of Go
10+
matrix:
11+
# strategy is used to allow us to pin to a specific Go version, or use the version available in our `go.mod`
12+
strategy: ['go-version']
13+
version: [1.21]
14+
include:
15+
# pick up the Go version from the `go.mod`
16+
- strategy: 'go-version-file'
17+
version: 'go.mod'
18+
steps:
19+
- name: Check out source code
20+
uses: actions/checkout@v3
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v3
24+
with:
25+
${{ matrix.strategy }}: ${{ matrix.version }}
26+
27+
- name: Test
28+
run: make test

Diff for: .github/workflows/generate.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Ensure generated files are up-to-date
2+
on: [ push, pull_request ]
3+
jobs:
4+
build:
5+
name: Build
6+
runs-on: ubuntu-latest
7+
strategy:
8+
fail-fast: false
9+
# perform matrix testing to give us an earlier insight into issues with different versions of supported major versions of Go
10+
matrix:
11+
# strategy is used to allow us to pin to a specific Go version, or use the version available in our `go.mod`
12+
strategy: ['go-version']
13+
version: [1.21]
14+
include:
15+
# pick up the Go version from the `go.mod`
16+
- strategy: 'go-version-file'
17+
version: 'go.mod'
18+
steps:
19+
- name: Check out source code
20+
uses: actions/checkout@v3
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v3
24+
with:
25+
${{ matrix.strategy }}: ${{ matrix.version }}
26+
27+
- name: Run `make generate`
28+
run: make generate
29+
30+
- name: Check for no untracked files
31+
run: git status && git diff-index --quiet HEAD --

Diff for: .github/workflows/lint.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Lint project
2+
on: [push, pull_request]
3+
jobs:
4+
build:
5+
name: Build
6+
runs-on: ubuntu-latest
7+
strategy:
8+
fail-fast: false
9+
# perform matrix testing to give us an earlier insight into issues with different versions of supported major versions of Go
10+
matrix:
11+
# strategy is used to allow us to pin to a specific Go version, or use the version available in our `go.mod`
12+
strategy: ['go-version']
13+
version: [1.21]
14+
include:
15+
# pick up the Go version from the `go.mod`
16+
- strategy: 'go-version-file'
17+
version: 'go.mod'
18+
steps:
19+
- name: Check out source code
20+
uses: actions/checkout@v3
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v3
24+
with:
25+
${{ matrix.strategy }}: ${{ matrix.version }}
26+
27+
- name: Run `make lint-ci`
28+
run: make lint-ci

Diff for: .github/workflows/tidy.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Ensure `go mod tidy` has been run
2+
on: [ push, pull_request ]
3+
jobs:
4+
build:
5+
name: Build
6+
runs-on: ubuntu-latest
7+
strategy:
8+
fail-fast: false
9+
# perform matrix testing to give us an earlier insight into issues with different versions of supported major versions of Go
10+
matrix:
11+
# strategy is used to allow us to pin to a specific Go version, or use the version available in our `go.mod`
12+
strategy: ['go-version']
13+
version: [1.21]
14+
include:
15+
# pick up the Go version from the `go.mod`
16+
- strategy: 'go-version-file'
17+
version: 'go.mod'
18+
steps:
19+
- name: Check out source code
20+
uses: actions/checkout@v3
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v3
24+
with:
25+
${{ matrix.strategy }}: ${{ matrix.version }}
26+
27+
- name: Install `tidied`
28+
run: go install gitlab.com/jamietanna/tidied@latest
29+
30+
- name: Check for no untracked files
31+
run: tidied -verbose

Diff for: Makefile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
GOBASE=$(shell pwd)
2+
GOBIN=$(GOBASE)/bin
3+
4+
help:
5+
@echo "This is a helper makefile for oapi-codegen"
6+
@echo "Targets:"
7+
@echo " generate: regenerate all generated files"
8+
@echo " test: run all tests"
9+
@echo " gin_example generate gin example server code"
10+
@echo " tidy tidy go mod"
11+
12+
$(GOBIN)/golangci-lint:
13+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.54.0
14+
15+
.PHONY: tools
16+
tools: $(GOBIN)/golangci-lint
17+
18+
lint: tools
19+
$(GOBIN)/golangci-lint run ./...
20+
21+
lint-ci: tools
22+
$(GOBIN)/golangci-lint run ./... --out-format=github-actions --timeout=5m
23+
24+
generate:
25+
go generate ./...
26+
27+
test:
28+
go test -cover ./...
29+
30+
tidy:
31+
@echo "tidy..."
32+
go mod tidy

Diff for: renovate.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"local>oapi-codegen/renovate-config"
5+
]
6+
}

0 commit comments

Comments
 (0)