Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
morremeyer committed Sep 4, 2022
0 parents commit 130318e
Show file tree
Hide file tree
Showing 29 changed files with 1,862 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
delay = 3000
16 changes: 16 additions & 0 deletions .github/.codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
codecov:
require_ci_to_pass: false

coverage:
status:
project:
default:
target: auto
threshold: 3%
informational: true

patch:
default:
target: auto
threshold: 25%
informational: true
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us fix bugs
title: ""
labels: bug
assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Logs**
If applicable, attach logs

<details><summary>Log output</summary>
```plain
Add your log output here.
```
</details>

**Additional context**
Add any other context about the problem here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature Request
about: Request a new feature, something that the software can’t do yet
title: ""
labels: enhancement
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
24 changes: 24 additions & 0 deletions .github/actions/go-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "go test"
description: "runs go tests"

runs:
using: "composite"
steps:
- name: Check out repository
uses: actions/[email protected]

- name: Set up go
uses: actions/[email protected]
with:
# renovate: go-version
go-version: 1.18.4

- name: Run go tests
shell: bash
run: |
go test ./... -race -covermode=atomic -coverprofile=coverage.out
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: coverage.out
20 changes: 20 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: pre-commit

on:
push:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]

- uses: actions/[email protected]
with:
go-version: 1.19.0

- name: Install go tooling
run: |
make setup-pre-commit-ci
- uses: pre-commit/[email protected]
25 changes: 25 additions & 0 deletions .github/workflows/renovate-config-validator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Validate renovate config

on:
push:
branches:
- main
paths:
- renovate.json
- .github/workflows/renovate-config-validator.yml
pull_request:
branches:
- main
paths:
- renovate.json
- .github/workflows/renovate-config-validator.yml

jobs:
validate:
name: Validate renovate config
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Validate
uses: rinchsan/[email protected]
17 changes: 17 additions & 0 deletions .github/workflows/semantic-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
semantic-pull-request:
name: Semantic Pull Request
runs-on: ubuntu-latest
steps:
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48 changes: 48 additions & 0 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: test & release

on:
push:
tags:
- "v*"

permissions:
contents: write
packages: write

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/[email protected]

- name: go test
uses: ./.github/actions/go-test

release:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up Go
uses: actions/[email protected]
with:
go-version: 1.19.0

- uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/test-and-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: test & tag

on:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/[email protected]

- name: go test
uses: ./.github/actions/go-test

tag:
runs-on: ubuntu-latest
needs: test
container: ghcr.io/caarlos0/svu
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
token: ${{ secrets.EZ_BOT_TOKEN }}

- name: Tag new version
run: |
if [ $(git tag -l "$(svu next)") ]; then
echo "Tag already exists, no release necessary"
else
echo "Tagging new version"
git tag "$(svu next)"
git push --tags
fi
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "test"

on:
push:
branches-ignore:
- main
tags-ignore:
- "v*"

workflow_call:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/[email protected]

- name: go test
uses: ./.github/actions/go-test
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
coverage.out
/standalone
dist/
tmp/
/data

# Created in the workflows but need to be ignored
node_modules/
package-lock.json
package.json

# VSCode logs
.vscode/*.log

# Frontend files
/public
32 changes: 32 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
issues:
fix: true

# Relax rules for tests
exclude-rules:
- path: _test\.go
linters:
- gocyclo
- errcheck
- dupl

linters:
enable:
- gocyclo
- godot
- gofumpt
- goimports
- govet
- revive
- whitespace
- misspell

linters-settings:
gofumpt:
lang-version: "1.19"
extra-rules: true
gocyclo:
min-complexity: 15

godot:
exclude:
- "^ @[A-Za-z]+ "
52 changes: 52 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ldflags:
- -X github.com/envelope-zero/backend/pkg/router.version=1.0.1

archives:
- replacements:
amd64: x86_64

snapshot:
name_template: "{{ incpatch .Version }}-next"

changelog:
use: github
groups:
- title: Features
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0

- title: "Bug fixes"
regexp: "^.*fix[(\\w)]*:+.*$"
order: 1

- title: Others
order: 2

- title: "Dependency updates"
regexp: "^.*chore(deps):+.*$"
order: 3

filters:
# Commit messages matching the regexp listed here will be removed from
# the changelog
exclude:
- "^docs:"
- "^test:"

dockers:
- dockerfile: Dockerfile.goreleaser
image_templates:
- "ghcr.io/envelope-zero/standalone:{{ .Tag }}"
- "ghcr.io/envelope-zero/standalone:v{{ .Major }}"
- "ghcr.io/envelope-zero/standalone:v{{ .Major }}.{{ .Minor }}"
- "ghcr.io/envelope-zero/standalone:latest"
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
default_stages: [commit]
repos:
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.0.0
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ["@commitlint/config-conventional"]

- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.0
hooks:
- id: go-mod-tidy
- id: golangci-lint
args:
- "--timeout=5m"

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
Loading

0 comments on commit 130318e

Please sign in to comment.