Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
name: 📋 GolangCI Checks
name: 📋 Lint

on:
pull_request:
types: [ synchronize, opened, reopened, ready_for_review ]

jobs:
lint:
name: 📋 GolangCI
runs-on: ubuntu-latest
steps:
- name: ⬇️ Git clone the repository
uses: actions/checkout@v6

- name: 📦 Install Mise
run: |
curl https://mise.run | sh
mise install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: jdx/mise-action@v4

- name: 🧪 Lint
run: |
mise run lint
run: mise run lint
8 changes: 2 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,12 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: 📦 Install Mise
run: |
curl https://mise.run | sh
mise install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: jdx/mise-action@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run GoReleaser
run: mise release
run: mise run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 2 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ jobs:
uses: actions/checkout@v6

- name: 📦 Install Mise
run: |
curl https://mise.run | sh
mise install
uses: jdx/mise-action@v4

- name: 🧪 Test
run: |
mise run test
run: mise run test
23 changes: 23 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: "2"

issues:
max-issues-per-linter: 0
max-same-issues: 0

linters:
enable:
- gosec

formatters:
enable:
- gci
settings:
gci:
sections:
- standard
- default
- localmodule
no-inline-comments: true
no-prefix-comments: true
custom-order: true
no-lex-order: true
9 changes: 5 additions & 4 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[tools]
go = "1.26"
"go:github.com/daixiang0/gci" = "latest"
"ubi:golangci/golangci-lint" = "2.10"
"ubi:goreleaser/goreleaser" = "2.14"
"github:golangci/golangci-lint" = "latest"
"github:securego/gosec" = "latest"
"github:goreleaser/goreleaser" = "latest"

[env]
CGO_ENABLED=0
LGFLAGS="-extldflags '-static'"
LDFLAGS="-extldflags '-static'"
IMAGE="skpr/grpc-go:latest"
PB_DIR="./pb"

Expand All @@ -32,7 +33,7 @@ docker run -w /data -v .:/data $IMAGE /bin/bash -c 'protoc --go_out=./pb --go_op

[tasks."build"]
description = "Build the application"
run = "go build -o bin/apiserver-mock -ldflags=${CLI_LDFLAGS} github.com/skpr/api/cmd/apiserver-mock"
run = "go build -o bin/apiserver-mock -ldflags=\"${LDFLAGS}\" github.com/skpr/api/cmd/apiserver-mock"
depends = ["vendor"]

[tasks.mock]
Expand Down
8 changes: 4 additions & 4 deletions internal/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (s *Model) GetEnvironments() []*Environment {
return response
}

func (s *Model) CreateEnvironment(name string, size int, metrics bool) {
func (s *Model) CreateEnvironment(name string, size int32, metrics bool) {
environment := &pb.Environment{
Name: name,
Version: "v0.0.1",
Expand All @@ -62,9 +62,9 @@ func (s *Model) CreateEnvironment(name string, size int, metrics bool) {
Limit: 512 * int64(size) * 1024,
},
Replicas: &pb.EnvironmentResourcesReplicas{
Current: 1 * int32(size),
Min: 1 * int32(size),
Max: 5 * int32(size),
Current: 1 * size,
Min: 1 * size,
Max: 5 * size,
},
},
Cron: []*pb.Cron{
Expand Down
2 changes: 1 addition & 1 deletion internal/random/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
func StringOfLength(length int) string {
b := make([]byte, length)
for i := range b {
b[i] = charset[rand.Intn(len(charset))]
b[i] = charset[rand.Intn(len(charset))] //nolint:gosec // G404: cosmetic random string, not used for auth/tokens
}
return string(b)
}
3 changes: 2 additions & 1 deletion internal/server/mock/metrics/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"strings"
"time"

"github.com/skpr/api/pb"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/skpr/api/pb"
)

// Server implements the GRPC "events" definition.
Expand Down
3 changes: 2 additions & 1 deletion internal/server/mock/metrics/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"testing"
"time"

"github.com/skpr/api/pb"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/skpr/api/pb"
)

var srv = &Server{}
Expand Down
Loading