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
5 changes: 4 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
version: 2

updates:
- package-ecosystem: "gomod"
directory: "/"
directories:
- "/"
- "/tools"
schedule:
interval: "weekly"

Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- main
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -18,6 +21,13 @@ jobs:
uses: actions/setup-go@v7
with:
go-version: "1.27.x"
check-latest: true
cache-dependency-path: |
go.sum
tools/go.sum

- name: Go version
run: go version

- name: Verify
run: make verify
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ linters:
- legacy
- std-error-handling
rules:
- path: ^(sqlite/(testexecution|testsuiteexecution)\.go)$
linters:
- dupl

- linters:
- dogsled
- dupl
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ normalizers: sqlc
lint: install-golangci-lint
$(GOLANGCI_LINT) run

.PHONY: vulncheck
vulncheck: install-govulncheck
@echo "Checking for known vulnerabilities..."
$(GOVULNCHECK) ./...

.PHONY: test
test:
@echo "Running tests..."
Expand All @@ -46,5 +51,5 @@ test-race:
@go test ./... -race -count=1 -timeout=600s

.PHONY: verify
verify: normalizers lint test-race
verify: normalizers lint vulncheck test-race
@echo "All verifications passed successfully."
9 changes: 8 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,29 @@ module github.com/e2engine/repository
go 1.27

require (
github.com/e2engine/core v0.2.1
github.com/e2engine/core v0.3.0
github.com/golang-migrate/migrate/v4 v4.20.1
github.com/ygrebnov/errorc v0.6.1
github.com/ygrebnov/keys v0.2.0
modernc.org/sqlite v1.60.1
)

require (
github.com/bufbuild/protocompile v0.14.1 // indirect
github.com/dustin/go-humanize v1.1.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/mattn/go-isatty v0.0.24 // indirect
github.com/ncruces/go-strftime v1.1.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/ygrebnov/log v0.4.4 // indirect
github.com/ygrebnov/model v0.7.5 // indirect
golang.org/x/net v0.61.0 // indirect
golang.org/x/sync v0.24.0 // indirect
golang.org/x/sys v0.49.0 // indirect
golang.org/x/text v0.43.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20261012220534-4341edf3f941 // indirect
google.golang.org/grpc v1.84.0 // indirect
google.golang.org/protobuf v1.36.12 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/libc v1.77.1 // indirect
modernc.org/mathutil v1.7.1 // indirect
Expand Down
15 changes: 10 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.1.0 h1:dbKTrvD0klcbBV/h4AWJdMuZogJACoMlvWIWZ5b2xWg=
github.com/dustin/go-humanize v1.1.0/go.mod h1:hc1CvRkJMsgxqjmjMQF3QNRAZBwY8AXBAzKYoSX9sFI=
github.com/e2engine/core v0.2.1 h1:U0K4Ak4RheCxVX9+pLUyF/k8mrRB9rb0ruxxa6JWUX4=
github.com/e2engine/core v0.2.1/go.mod h1:8oN/239uuU+jNNA+CxDF7h68HKh0cL+vON9D/mcqN/Y=
github.com/e2engine/core v0.3.0 h1:hx7THwTfc9wYtFOW7sE9kfLNFOG8ff/2tD+lD4pvzmM=
github.com/e2engine/core v0.3.0/go.mod h1:8oN/239uuU+jNNA+CxDF7h68HKh0cL+vON9D/mcqN/Y=
github.com/golang-migrate/migrate/v4 v4.20.1 h1:2N/ToVTKrKl58ynBpgeVJ4In7VcLCjWTZtm4eP1LxhU=
github.com/golang-migrate/migrate/v4 v4.20.1/go.mod h1:DDPgKVb4ovSWc4FwSPfV2Uz1160f4XBiTHTrAJtljmM=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/pprof v0.0.0-20260802141513-ef3492d7dac3 h1:LMLX+LgTNWpfvCBdFebv6EsYotImrt/Ppc5cXIriCSo=
github.com/google/pprof v0.0.0-20260802141513-ef3492d7dac3/go.mod h1:jl5iWTm0/hd5PjEYEOuwAJ57L/CibdZfrqZ5XA5GrCk=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
Expand Down Expand Up @@ -46,9 +50,10 @@ golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA=
golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc=
golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s=
golang.org/x/tools v0.50.0 h1:c2ifzfcuY7L90lZ2aKd8S4K2NpASF08SZx9ZuJkHmSU=
golang.org/x/tools v0.50.0/go.mod h1:7ulVMw3831Mwi5EZD6RomGyffr4VFjuNYXf2BbCEAV0=
google.golang.org/genproto v0.0.0-20260630182238-925bb5da69e7 h1:lQG76ePMKmtujel4VIVMiFoHVWVNtJdawbCZJtWlVXU=
golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI=
golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA=
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/genproto/googleapis/rpc v0.0.0-20261012220534-4341edf3f941 h1:QG6hS4zFplRZvOQedzei4t2pT/zkQc3VR1u+S9/rcAw=
google.golang.org/genproto/googleapis/rpc v0.0.0-20261012220534-4341edf3f941/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
google.golang.org/grpc v1.84.0 h1:soMyaPJ8pAak5PIQ0DGBUir0XRo2fRoMqhNWMLlLxO0=
Expand Down
3 changes: 2 additions & 1 deletion sqlite/internal/sqlc/querier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions sqlite/internal/sqlc/resources.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 46 additions & 2 deletions sqlite/internal/sqlc/test_executions.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions sqlite/internal/sqlc/test_suite_executions.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions sqlite/internal/sqlc/test_tags.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions sqlite/query/resources.sql
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ SELECT id
FROM resources
WHERE kind = sqlc.arg(kind)
AND id LIKE sqlc.arg(prefix) || '%'
ORDER BY id ASC;
ORDER BY id ASC
LIMIT 2;


-- name: GetResourceIDsByName :many
SELECT id
FROM resources
WHERE kind = sqlc.arg(kind)
AND name LIKE sqlc.arg(prefix) || '%'
ORDER BY name ASC, id ASC;
ORDER BY name ASC, id ASC
LIMIT 2;


-- ============================================================================
Expand Down
27 changes: 20 additions & 7 deletions sqlite/query/test_executions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ WHERE id = sqlc.arg(id)
SELECT id
FROM test_executions
WHERE id LIKE sqlc.arg(prefix) || '%'
ORDER BY id ASC;
ORDER BY id ASC
LIMIT 2;


-- ============================================================================
Expand Down Expand Up @@ -621,6 +622,15 @@ SELECT status
FROM test_executions
WHERE id = sqlc.arg(id);

-- name: GetTestSuiteExecutionStats :many
SELECT
status,
COUNT(*) AS count,
MAX(finished_at) AS last_test_finished_at
FROM test_executions
WHERE test_suite_execution_id =
CAST(sqlc.arg(test_suite_execution_id) AS TEXT)
GROUP BY status;

-- ============================================================================
-- State transitions
Expand All @@ -632,14 +642,17 @@ SET
started_at = sqlc.arg(started_at),
status = 'running'
WHERE id = sqlc.arg(id)
RETURNING id;
AND status = 'scheduled'
RETURNING id;


-- name: SetTestExecutionCompleted :one
UPDATE test_executions
SET
finished_at = sqlc.arg(finished_at),
status = sqlc.arg(status),
summary = sqlc.arg(summary)
WHERE id = sqlc.arg(id)
RETURNING id;
finished_at = ?1,
status = ?2,
summary = ?3
WHERE id = ?4
AND status IN ('scheduled', 'running')
AND ?2 IN ('passed', 'failed', 'error')
RETURNING id;
18 changes: 11 additions & 7 deletions sqlite/query/test_suite_executions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ WHERE id = sqlc.arg(id)
SELECT id
FROM test_suite_executions
WHERE id LIKE sqlc.arg(prefix) || '%'
ORDER BY id ASC;
ORDER BY id ASC
LIMIT 2;


-- name: GetTestSuiteExecutionIDsByTestSuiteID :many
Expand Down Expand Up @@ -672,14 +673,17 @@ SET
started_at = sqlc.arg(started_at),
status = 'running'
WHERE id = sqlc.arg(id)
RETURNING id;
AND status = 'scheduled'
RETURNING id;


-- name: SetTestSuiteExecutionCompleted :one
UPDATE test_suite_executions
SET
finished_at = sqlc.arg(finished_at),
status = sqlc.arg(status),
summary = sqlc.narg(summary)
WHERE id = sqlc.arg(id)
RETURNING id;
finished_at = ?1,
status = ?2,
summary = ?3
WHERE id = ?4
AND status IN ('scheduled', 'running')
AND ?2 IN ('passed', 'failed', 'error')
RETURNING id;
3 changes: 2 additions & 1 deletion sqlite/query/test_tags.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ FROM resources r
ON tt.test_id = r.id
WHERE tt.tag = sqlc.arg(tag)
AND r.kind = 'test'
ORDER BY r.id ASC;
ORDER BY r.id ASC
LIMIT sqlc.arg(limit);
Loading
Loading