-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ on: | |
push: | ||
branches: | ||
- main | ||
- master | ||
paths: | ||
- .github/workflows/semgrep.yml | ||
schedule: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
run: | ||
tests: true | ||
build-tags: | ||
- integration | ||
output: | ||
formats: | ||
- format: checkstyle | ||
path: build/report.xml | ||
- format: colored-line-number | ||
linters: | ||
enable: | ||
- errcheck | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- unused | ||
- goimports | ||
- goheader | ||
- gosec | ||
- forbidigo | ||
- goconst | ||
- godot | ||
issues: | ||
exclude-rules: | ||
- linters: | ||
- goheader | ||
path: cache.go # This file already has a header with another license | ||
linters-settings: | ||
goimports: | ||
local-prefixes: github.com/madsrc/sophrosyne | ||
gofmt: | ||
simplify: true | ||
rewrite-rules: | ||
- pattern: 'interface{}' | ||
replacement: 'any' | ||
- pattern: 'a[b:len(a)]' | ||
replacement: 'a[b:]' | ||
goheader: | ||
values: | ||
const: | ||
AUTHOR: 'Mads R. Havmand' | ||
template: |- | ||
Sophrosyne | ||
Copyright (C) {{ YEAR }} {{ AUTHOR }} | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[tools] | ||
go = "latest" | ||
watchexec = "latest" | ||
"go:github.com/golangci/golangci-lint/cmd/golangci-lint" = "1.58.1" | ||
"go:golang.org/x/tools/cmd/goimports" = "latest" | ||
|
||
[settings] | ||
experimental = true | ||
go_set_gobin = true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
rm -rf build | ||
rm -rf dist |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
# mise outputs=[] | ||
|
||
docker compose -f docker-compose.development.yml down |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
# mise outputs=[] | ||
|
||
docker compose -f docker-compose.development.yml up -d |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh | ||
# mise sources=["go.mod", "go.sum", "internal/**/*", "cmd/**/*", "*.go"] | ||
# mise outputs=["build/report.xml"] | ||
|
||
check=1 | ||
|
||
handle_argument() { | ||
echo "Argument '$1' not supported" >&2; exit 1 | ||
} | ||
|
||
while test "$#" -gt 0; do | ||
case "$1" in | ||
--check) check=0; shift 1;; | ||
|
||
-*) echo "unknown option: $1" >&2; exit 1;; | ||
*) handle_argument "$1"; shift 1;; | ||
esac | ||
done | ||
|
||
if test "$check" = 0; then | ||
changes=$(goimports -l -local github.com/madsrc/sophrosyne -e .) | ||
if test -n "$changes"; then | ||
echo "$changes" | ||
exit 1 | ||
else | ||
exit 0 | ||
fi | ||
else | ||
goimports -w -local github.com/madsrc/sophrosyne -e . | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh | ||
# mise sources=["go.mod", "go.sum", "internal/**/*", "cmd/**/*", "*.go"] | ||
# mise outputs=["build/report.xml"] | ||
|
||
nofail=1 | ||
fix=1 | ||
|
||
fixflag="" | ||
|
||
handle_argument() { | ||
echo "Argument '$1' not supported" >&2; exit 1 | ||
} | ||
|
||
while test "$#" -gt 0; do | ||
case "$1" in | ||
--no-fail) nofail=0; shift 1;; | ||
--fix) fix=0; shift 1;; | ||
|
||
-*) echo "unknown option: $1" >&2; exit 1;; | ||
*) handle_argument "$1"; shift 1;; | ||
esac | ||
done | ||
|
||
if test "$fix" = 0; then | ||
fixflags="--fix" | ||
fi | ||
|
||
golangci-lint run --issues-exit-code="$nofail" $fixflags |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
# mise outputs=[] | ||
|
||
docker compose -f docker-compose.development.yml up -d | ||
SOPH_LOGGING_LEVEL=debug \ | ||
SOPH_TRACING_OUTPUT=http \ | ||
SOPH_METRICS_OUTPUT=http \ | ||
SOPH_METRICS_ENABLED=true \ | ||
SOPH_TRACING_ENABLED=true \ | ||
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318" \ | ||
OTEL_TRACES_EXPORTER="otlp" \ | ||
OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf" \ | ||
go run cmd/sophrosyne/main.go --config configurations/dev.yaml run |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
# mise outputs=[] | ||
|
||
set -e | ||
|
||
version=$(grep -E "^go .*$" go.mod | awk '{print $2}') | ||
|
||
echo "Version extracted from go.mod: $version" | ||
|
||
echo "Setting go version in .mise.toml" | ||
mise use "go@$version" | ||
|
||
echo "Setting go version in .idea/workspace.xml" | ||
sed -i "s/.local\/share\/mise\/installs\/go\/.*\"/.local\/share\/mise\/installs\/go\/$version\"/g" .idea/workspace.xml |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,3 @@ | ||
FROM cgr.dev/chainguard/python:latest-dev@sha256:40b3a19b7e2a50824b1ff32d61ae5f59af1b0de67f7bb8e56f5804bace0d94b7 AS builder | ||
|
||
ARG dist_file | ||
|
||
WORKDIR /app | ||
|
||
COPY "dist/${dist_file}" "/home/nonroot/${dist_file}" | ||
|
||
RUN --mount=type=secret,id=requirements,dst=/home/nonroot/requirements.txt,uid=65532,gid=65532 \ | ||
pip install --no-cache-dir -r "/home/nonroot/requirements.txt" | ||
RUN pip install --no-cache-dir "/home/nonroot/${dist_file}" | ||
|
||
FROM cgr.dev/chainguard/python:latest@sha256:5f16431f56f330925a9c8f5168b31ca65f603de15b127b376f8532bab11583c0 | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /home/nonroot/.local/lib/python3.12/site-packages /home/nonroot/.local/lib/python3.12/site-packages | ||
|
||
ENTRYPOINT [ "python", "-m", "sophrosyne.main", "run" ] | ||
FROM cgr.dev/chainguard/glibc-dynamic:latest | ||
COPY --chown=noneroot:noneroot dist/sophrosyne /usr/bin/ | ||
ENTRYPOINT ["/usr/bin/sophrosyne"] |