Skip to content

Commit

Permalink
feat: add cursor impl
Browse files Browse the repository at this point in the history
  • Loading branch information
benjivesterby committed Mar 11, 2024
1 parent 5a06730 commit 1fec467
Show file tree
Hide file tree
Showing 28 changed files with 738 additions and 145 deletions.
4 changes: 2 additions & 2 deletions .cm/approve-safe-changes.cm
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ automations:
safe_changes:
if:
- {{ is.formatting or is.docs or is.tests or is.asset }}
run:
run:
- action: add-label@v1
args:
label: 'safe-changes'
- action: approve@v1

# To simplify the automation, this calculation is placed under a unique YAML key.
# The result is is assigned to `is.formatting`, `is.docs` and `is.tests` which is
# The result is is assigned to `is.formatting`, `is.docs` and `is.tests` which is
# used in the automation above. You can add as many keys as you like.
is:
formatting: {{ source.diff.files | isFormattingChange }}
Expand Down
4 changes: 2 additions & 2 deletions .cm/assign-the-relevant-reviewers-to-prs.cm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ manifest:

automations:
the_right_reviewer:
if:
if:
- true
run:
- action: add-comment@v1
Expand All @@ -14,4 +14,4 @@ automations:
{{ repo | explainRankByGitBlame(gt=25) }}
- action: add-reviewers@v1
args:
reviewers: {{ repo | rankByGitBlame(gt=25) | random }}
reviewers: {{ repo | rankByGitBlame(gt=25) | random }}
2 changes: 1 addition & 1 deletion .cm/label-prs-by-complexity.cm
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ automations:
# The result is assigned to `calc.etr` which is used in the automation above.
# You can add as many keys as you like.
calc:
etr: {{ branch | estimatedReviewTime }}
etr: {{ branch | estimatedReviewTime }}
2 changes: 1 addition & 1 deletion .cm/mark-prs-with-deleted-files.cm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ automations:
deleted:
if:
- {{ has.deleted_files }}
run:
run:
- action: add-label@v1
args:
label: 'deleted-files'
Expand Down
4 changes: 2 additions & 2 deletions .cm/mark-prs-without-tests.cm
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ automations:
no_tests:
if:
- {{ files | match(regex=r/(test|spec)/) | nope }}
run:
run:
- action: add-label@v1
args:
label: 'missing-tests'
color: '#E94637'
color: '#E94637'
2 changes: 1 addition & 1 deletion .cm/more-approvals-for-complex-changes.cm
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ automations:
run:
- action: set-required-approvals@v1
args:
approvals: 2
approvals: 2
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @benjivesterby
* @benjivesterby
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ updates:
schedule:
interval: "daily"
labels:
- "automerge"
- "automerge"
2 changes: 1 addition & 1 deletion .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_METHOD: squash
MERGE_LABELS: automerge
MERGE_LABELS: automerge
36 changes: 5 additions & 31 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,11 @@ permissions:
contents: write
deployments: write

env:
GH_ACCESS_TOKEN: ${{ secrets.GH_PAT }}

jobs:
benchmark:
name: Execute Benchmarks
strategy:
matrix:
go-version: [1.19.x]
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
stable: false
- name: Checkout code
uses: actions/checkout@v4
- name: Run benchmark
run: go test -bench=. ./... | tee output.txt
- name: Download previous benchmark data
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Benchmark Results
tool: 'go'
output-file-path: output.txt
benchmark-data-dir-path: dev/bench
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: '200%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@benjivesterby'
uses: devnw/workflows/.github/workflows/make-bench.yml@main
secrets: inherit # pragma: allowlist secret
48 changes: 8 additions & 40 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,12 @@
name: Build & Test
name: Lint, Build & Test

# this is triggered on push to the repository
on: [push, pull_request]

env:
GH_ACCESS_TOKEN: ${{ secrets.GH_PAT }}

jobs:
build:
name: "Build"
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: true
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
- name: Checkout code
uses: actions/checkout@v4
- name: Build
run: go build ./...
test:
name: "Unit Tests"
needs: [build]
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: true
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
- name: Test
run: go test -failfast ./... -race -coverprofile=coverage.txt -covermode=atomic
- name: Push Coverage to codecov.io
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
lint-build-test:
name: Lint, Build & Test
uses: devnw/workflows/.github/workflows/make-build-nix.yml@main
secrets: inherit # pragma: allowlist secret
2 changes: 1 addition & 1 deletion .github/workflows/gitstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
description: the head sha
required: true
base_ref:
description: the base ref
description: the base ref
required: true
installation_id:
description: the installation id
Expand Down
43 changes: 11 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,16 @@ on:
push:
tags:
- "v*"
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_PAT }}

permissions:
contents: write
packages: write
issues: write

jobs:
build:
name: "Build & Unit Tests"
strategy:
matrix:
platform: [ubuntu-latest]
fail-fast: true
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
- name: Docker Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PAT }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
release:
name: Tagged Release
uses: devnw/workflows/.github/workflows/make-release.yml@main
secrets: inherit # pragma: allowlist secret
16 changes: 14 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
eml-hdr-extract
*cweb.log
*.tmp
.venv
.act

# outputs
output.txt
dist/

# build folders
bin/
ui/public/
ui/build/
ui/node_modules/

# Removing Vendor
vendor/
testdata/remote

.vscode/

Expand All @@ -21,6 +31,8 @@ testdata/remote
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.html
coverage
coverage.txt

# ignore keyfiles
*.crt
Expand Down
11 changes: 7 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ linters-settings:
recommendations:
- github.com/google/uuid
reason: "satori's package is not maintained"
- github.com/gofrs/uuid:
recommendations:
- github.com/google/uuid
reason: "see recommendation from dev-infra team: https://confluence.gtforge.com/x/gQI6Aw"

govet:
# Enable all analyzers.
Expand Down Expand Up @@ -138,10 +142,10 @@ linters-settings:
tagliatelle:
case:
rules:
# Support string case:
# `camel`, `pascal`, `kebab`, `snake`, `goCamel`,
# Support string case:
# `camel`, `pascal`, `kebab`, `snake`, `goCamel`,
# `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`
json: snake
json: snake
yaml: camel
xml: camel

Expand Down Expand Up @@ -178,7 +182,6 @@ linters:
- goconst # finds repeated strings that could be replaced by a constant
- gocritic # provides diagnostics that check for bugs, performance and style issues
- gocyclo # computes and checks the cyclomatic complexity of functions
- godot # checks if comments end in a period
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
- gomnd # detects magic numbers
- gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
Expand Down
18 changes: 18 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
builds:
- skip: true

checksum:
name_template: 'checksums.txt'

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

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

release:
prerelease: auto
59 changes: 37 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,47 @@
exclude: '^data/|.env'
fail_fast: true
repos:
- repo: https://github.com/Yelp/detect-secrets
- repo: local
hooks:
- id: license-header
name: License Header
entry: ./scripts/license.py
language: system
always_run: true
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
- id: detect-secrets
name: Detect secrets
language: python
entry: detect-secrets-hook
args: ['--baseline', '.secrets.baseline']
- repo: https://github.com/golangci/golangci-lint
rev: v1.54.2
hooks:
- id: golangci-lint
- repo: https://github.com/Bahjat/pre-commit-golang
rev: v1.0.3 # pragma: allowlist secret
args:
- '--baseline'
- '.secrets.baseline'
- repo: https://github.com/sqlfluff/sqlfluff
rev: 3.0.0a6
hooks:
- id: go-unit-tests
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
- id: sqlfluff-fix
- repo: https://github.com/syntaqx/git-hooks
rev: v0.0.18
hooks:
- id: check-json
- id: pretty-format-json
- id: check-merge-conflict
- id: check-yaml
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.37.0
- id: forbid-binary
- id: shellcheck
- id: shfmt
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.18.2
hooks:
- id: markdownlint-fix
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.9.0
- id: commitizen
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: shellcheck
- id: check-json
- id: check-merge-conflict
- id: check-yaml
- id: trailing-whitespace
- id: check-shebang-scripts-are-executable
- id: check-vcs-permalinks
- id: check-toml
- id: check-xml
- id: check-yaml
- id: end-of-file-fixer
Loading

0 comments on commit 1fec467

Please sign in to comment.