-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
186 changed files
with
24,902 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": [ | ||
"config:best-practices", | ||
"schedule:weekly", | ||
":combinePatchMinorReleases", | ||
":approveMajorUpdates" | ||
], | ||
"labels": [ | ||
"dependencies" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
name: app | ||
|
||
on: [push] | ||
|
||
defaults: | ||
run: | ||
working-directory: ./app | ||
|
||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: jdx/mise-action@v2 | ||
with: | ||
version: 2024.10.7 | ||
install: true | ||
experimental: true | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.23.4' | ||
cache-dependency-path: 'app/go.sum' | ||
- run: go mod tidy | ||
- run: task gen | ||
- name: Save task cache | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ./.task | ||
key: task-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.task/checksum/*') }} | ||
- name: Check git status | ||
run: if [[ -n $(git status --porcelain) ]]; then git status --porcelain && exit 1; fi | ||
|
||
lint: | ||
needs: [prepare] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Restore task cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ./.task | ||
key: task-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.task/checksum/*') }} | ||
- uses: jdx/mise-action@v2 | ||
with: | ||
version: 2024.10.7 | ||
install: false | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.23.4' | ||
cache-dependency-path: 'app/go.sum' | ||
- uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.61.0 | ||
working-directory: ./app | ||
args: --path-prefix=./ | ||
|
||
test: | ||
needs: [prepare] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Restore task cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ./.task | ||
key: task-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.task/checksum/*') }} | ||
- uses: jdx/mise-action@v2 | ||
with: | ||
version: 2024.10.7 | ||
install: false | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.23.4' | ||
cache-dependency-path: 'app/go.sum' | ||
- run: task test | ||
|
||
build: | ||
needs: [prepare] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Restore task cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ./.task | ||
key: task-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.task/checksum/*') }} | ||
- uses: jdx/mise-action@v2 | ||
with: | ||
version: 2024.10.7 | ||
install: false | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.23.4' | ||
cache-dependency-path: 'app/go.sum' | ||
- run: task build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Misc | ||
.DS_Store | ||
|
||
# Environment | ||
.env | ||
.env.local | ||
.env.*.local | ||
|
||
# Editor | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
# Go | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
*.test | ||
*.out | ||
go.work | ||
|
||
# Dist | ||
dist/ | ||
|
||
# Terraform | ||
**/.terraform/* | ||
*.tfstate | ||
*.tfstate.* | ||
*.tfvars | ||
.terraform.tfstate.lock.info | ||
!infra/spacelift/init/*.tfstate | ||
!infra/spacelift/init/*.tfstate.* | ||
|
||
# Task | ||
.task/ | ||
|
||
# Mise | ||
.mise.local.toml | ||
.mise.*.local.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[tools] | ||
atlas = "0.29.0" | ||
mkcert = "1.4.4" | ||
go = "1.23.4" | ||
golangci-lint = "1.62.2" | ||
opentofu = "1.8.7" | ||
protoc = "29.1" | ||
protoc-gen-go = "1.35.2" | ||
protoc-gen-go-grpc = "1.5.1" | ||
task = "3.40.1" | ||
|
||
"go:github.com/sqlc-dev/sqlc/cmd/sqlc" = "1.27.0" | ||
"go:goa.design/goa/v3/cmd/goa" = "3.19.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
--- | ||
version: '3' | ||
|
||
vars: | ||
VERSION: | ||
sh: git describe --tags --exact-match HEAD 2>/dev/null || echo "0.0.0" | ||
GIT_COMMIT: | ||
sh: git rev-parse --short HEAD | ||
LDFLAGS: | ||
- '-X github.com/jace-ys/countup/internal/versioninfo.Version={{ .VERSION }}' | ||
- '-X github.com/jace-ys/countup/internal/versioninfo.CommitSHA={{ .GIT_COMMIT }}' | ||
|
||
tasks: | ||
run:server: | ||
deps: ['gen'] | ||
dir: app | ||
cmds: | ||
- go run ./cmd/countup/... server {{ .CLI_ARGS }} | ||
env: | ||
DEBUG: true | ||
OTEL_GO_X_EXEMPLAR: true | ||
OTEL_RESOURCE_ATTRIBUTES: tier=app,environment=local | ||
DATABASE_CONNECTION_URI: postgresql://countup:countup@localhost:5432/countup | ||
OAUTH_REDIRECT_URL: https://localhost:4043/login/google/callback | ||
|
||
run:client: | ||
deps: ['gen'] | ||
dir: app | ||
cmds: | ||
- go run ./cmd/countup-cli/... {{ .CLI_ARGS }} | ||
|
||
test: | ||
deps: ['gen'] | ||
dir: app | ||
cmds: | ||
- go test -race ./... | ||
|
||
lint: | ||
deps: ['gen'] | ||
dir: app | ||
cmds: | ||
- golangci-lint run ./... | ||
|
||
gen: | ||
dir: app | ||
cmds: | ||
- task: gen:api:v1 | ||
- task: gen:sqlc | ||
|
||
gen:api:*: | ||
internal: true | ||
dir: app | ||
vars: | ||
API_VERSION: '{{ index .MATCH 0 }}' | ||
cmds: | ||
- goa gen github.com/jace-ys/countup/api/{{ .API_VERSION }} -o api/{{ .API_VERSION }} | ||
sources: | ||
- api/{{ .API_VERSION }}/*.go | ||
generates: | ||
- api/{{ .API_VERSION }}/gen/**/* | ||
|
||
gen:sqlc: | ||
internal: true | ||
deps: ['migration:plan'] | ||
dir: app | ||
cmds: | ||
- sqlc generate | ||
sources: | ||
- sqlc.yaml | ||
- schema/*.sql | ||
|
||
migration:new: | ||
dir: app | ||
cmds: | ||
- atlas migrate new --env local {{ .NAME }} | ||
requires: | ||
vars: [NAME] | ||
|
||
migration:plan: | ||
dir: app | ||
cmds: | ||
- atlas migrate diff --env local {{ .NAME }} | ||
sources: | ||
- schema/schema.sql | ||
- schema/migrations/*.sql | ||
generates: | ||
- schema/migrations/*.sql | ||
|
||
migration:checksum: | ||
dir: app | ||
cmds: | ||
- atlas migrate hash --env local | ||
|
||
build: | ||
deps: ['gen'] | ||
dir: app | ||
cmds: | ||
- task: build:server | ||
- task: build:client | ||
- task: build:image | ||
|
||
build:server: | ||
internal: true | ||
dir: app | ||
cmds: | ||
- go build -ldflags='{{ .LDFLAGS | join " " }}' -o ./dist/ ./cmd/countup/... | ||
|
||
build:client: | ||
internal: true | ||
dir: app | ||
cmds: | ||
- go build -ldflags='{{ .LDFLAGS | join " " }}' -o ./dist/ ./cmd/countup-cli/... | ||
|
||
build:image: | ||
internal: true | ||
dir: app | ||
cmds: | ||
- docker build --build-arg LDFLAGS='{{ .LDFLAGS | join " " }}' -t jace-ys/countup:{{ .VERSION }} . | ||
|
||
certs:traefik: | ||
dir: infra/environments/local/compose/traefik/certs | ||
cmds: | ||
- mkcert -install | ||
- mkcert -cert-file traefik.cert -key-file traefik.key localhost 127.0.0.1 ::1 | ||
status: | ||
- test -f traefik.cert | ||
- test -f traefik.key | ||
|
||
compose: | ||
ignore_error: true | ||
deps: ['gen', 'certs:traefik'] | ||
cmds: | ||
- docker compose --profile apps up --build {{ .CLI_ARGS }} | ||
- defer: {task: 'compose:down'} | ||
|
||
compose:infra: | ||
ignore_error: true | ||
deps: ['gen', 'certs:traefik'] | ||
cmds: | ||
- docker compose up {{ .CLI_ARGS }} | ||
- defer: {task: 'compose:down'} | ||
|
||
compose:down: | ||
ignore_error: true | ||
cmds: | ||
- docker compose down -v --remove-orphans | ||
|
||
spacelift:init: | ||
dir: infra/spacelift/init | ||
cmds: | ||
- tofu apply |
Oops, something went wrong.