Skip to content

Commit

Permalink
chore: init
Browse files Browse the repository at this point in the history
  • Loading branch information
johnletey committed Jun 10, 2024
0 parents commit 7f5928e
Show file tree
Hide file tree
Showing 20 changed files with 2,441 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
parsers:
go:
partials_as_hits: true
28 changes: 28 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Unit Tests

on:
push:
branches:
- main
- v*
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Run Tests
run: make test-unit

- name: Upload Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
coverage.out
61 changes: 61 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
.PHONY: proto-format proto-lint proto-gen format lint test-unit
all: proto-all format lint test-unit

###############################################################################
### Formatting & Linting ###
###############################################################################

gofumpt_cmd=mvdan.cc/gofumpt
golangci_lint_cmd=github.com/golangci/golangci-lint/cmd/golangci-lint

format:
@echo "🤖 Running formatter..."
@go run $(gofumpt_cmd) -l -w .
@echo "✅ Completed formatting!"

lint:
@echo "🤖 Running linter..."
@go run $(golangci_lint_cmd) run --timeout=10m
@echo "✅ Completed linting!"

###############################################################################
### Protobuf ###
###############################################################################

BUF_VERSION=1.32

proto-all: proto-format proto-lint proto-gen

proto-format:
@echo "🤖 Running protobuf formatter..."
@cd proto
@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
bufbuild/buf:$(BUF_VERSION) format --diff --write
@echo "✅ Completed protobuf formatting!"

proto-gen:
@echo "🤖 Generating code from protobuf..."
@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
adr36-proto sh ./proto/generate.sh
@echo "✅ Completed code generation!"

proto-lint:
@echo "🤖 Running protobuf linter..."
@cd proto
@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
bufbuild/buf:$(BUF_VERSION) lint
@echo "✅ Completed protobuf linting!"

proto-setup:
@echo "🤖 Setting up protobuf environment..."
@docker build --rm --tag adr36-proto:latest --file proto/Dockerfile .
@echo "✅ Setup protobuf environment!"

###############################################################################
### Testing ###
###############################################################################

test-unit:
@echo "🤖 Running unit tests..."
@go test -cover -coverprofile=coverage.out -race -v .
@echo "✅ Completed unit tests!"
4 changes: 4 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: v1
plugins:
- name: gocosmos
out: .
2 changes: 2 additions & 0 deletions buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Generated by buf. DO NOT EDIT.
version: v2
6 changes: 6 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: v2
modules:
- path: proto
lint:
except:
- PACKAGE_VERSION_SUFFIX
1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
adr36.dev
25 changes: 25 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>adr36.dev</title>
<meta name="go-import" content="adr36.dev git https://github.com/noble-assets/adr36">
<meta name="go-source" content="adr36.dev https://github.com/noble-assets/adr36 https://github.com/noble-assets/adr36/tree/main{/dir} https://github.com/noble-assets/adr36/blob/main{/dir}/{file}#L{line}">
<style>
* { font-family: sans-serif; }
body { margin-top: 0; }
.content { display: inline-block; }
code { display: block; font-family: monospace; font-size: 1em; background-color: #d5d5d5; padding: 1em; margin-bottom: 16px; }
ul { margin-top: 16px; margin-bottom: 16px; }
</style>
</head>
<body>
<div class="content">
<h2>adr36.dev</h2>
<code>go get adr36.dev</code>
<code>import "adr36.dev"</code>
Home: <a href="https://pkg.go.dev/adr36.dev">https://pkg.go.dev/adr36.dev</a><br/>
Source: <a href="https://github.com/noble-assets/adr36">https://github.com/noble-assets/adr36</a><br/>
</div>
</body>
</html>
Loading

0 comments on commit 7f5928e

Please sign in to comment.