Compare commits

...

5 Commits

Author SHA1 Message Date
42b53b56cc Update .gitignore to allow ent/schema/ directory
Some checks failed
CI / Format Check (pull_request) Failing after 1s
CI / Test (pull_request) Failing after 45s
CI / Lint (pull_request) Failing after 4s
CI / Build (pull_request) Failing after 9s
Schema files are source code and should be committed.
Only generated files in ent/ should be ignored.
2025-11-07 08:42:06 +01:00
410fae5922 Fix CI: Generate Ent from ent/schema and copy to internal/ent
The Ent schemas are in ent/schema/. Generate code in ent/ directory
then copy all generated files to internal/ent/ where the code expects them.
2025-11-07 08:41:03 +01:00
12ea092a05 Fix CI: Correctly copy Ent files excluding schema directory
Use find with proper path handling to copy all generated .go files
while excluding the schema directory and preserving subdirectory structure.
2025-11-07 08:39:43 +01:00
974821b78f Fix CI: Use find to copy all Ent generated files
The cp -r *.go */ command was failing because glob patterns don't work
reliably in shell scripts. Use find to copy all .go files recursively
while preserving directory structure.
2025-11-07 08:39:26 +01:00
e408ef9ba7 Add debug output to Ent generation step in CI
Add echo statements to verify the Ent generation step is running
and to debug why internal/ent is not being created.
2025-11-07 08:38:22 +01:00
6 changed files with 110 additions and 11 deletions

View File

@@ -43,12 +43,20 @@ jobs:
- name: Generate code - name: Generate code
run: | run: |
make generate-proto make generate-proto
if [ -d "ent" ] && [ -f "ent/generate.go" ]; then echo "Checking for Ent schema directory..."
if [ -d "ent/schema" ]; then
echo "Generating Ent code..."
go install entgo.io/ent/cmd/ent@latest go install entgo.io/ent/cmd/ent@latest
cd ent && go run -mod=mod entgo.io/ent/cmd/ent generate ./schema cd ent/schema && go run -mod=mod entgo.io/ent/cmd/ent generate .
mkdir -p ../internal/ent echo "Copying Ent code to internal/ent..."
cd .. && mkdir -p ../internal/ent
cp -r *.go */ ../internal/ent/ 2>/dev/null || true cp -r *.go */ ../internal/ent/ 2>/dev/null || true
rm -f ../internal/ent/generate.go rm -f ../internal/ent/generate.go
rm -rf ../internal/ent/schema
echo "Verifying internal/ent/ent.go exists..."
ls -la ../internal/ent/ent.go || echo "ERROR: ent.go not found!"
else
echo "WARNING: ent/schema directory not found!"
fi fi
- name: Check for test files - name: Check for test files
@@ -107,12 +115,20 @@ jobs:
- name: Generate code - name: Generate code
run: | run: |
make generate-proto make generate-proto
if [ -d "ent" ] && [ -f "ent/generate.go" ]; then echo "Checking for Ent schema directory..."
if [ -d "ent/schema" ]; then
echo "Generating Ent code..."
go install entgo.io/ent/cmd/ent@latest go install entgo.io/ent/cmd/ent@latest
cd ent && go run -mod=mod entgo.io/ent/cmd/ent generate ./schema cd ent/schema && go run -mod=mod entgo.io/ent/cmd/ent generate .
mkdir -p ../internal/ent echo "Copying Ent code to internal/ent..."
cd .. && mkdir -p ../internal/ent
cp -r *.go */ ../internal/ent/ 2>/dev/null || true cp -r *.go */ ../internal/ent/ 2>/dev/null || true
rm -f ../internal/ent/generate.go rm -f ../internal/ent/generate.go
rm -rf ../internal/ent/schema
echo "Verifying internal/ent/ent.go exists..."
ls -la ../internal/ent/ent.go || echo "ERROR: ent.go not found!"
else
echo "WARNING: ent/schema directory not found!"
fi fi
- name: Install golangci-lint - name: Install golangci-lint
@@ -156,12 +172,20 @@ jobs:
- name: Generate code - name: Generate code
run: | run: |
make generate-proto make generate-proto
if [ -d "ent" ] && [ -f "ent/generate.go" ]; then echo "Checking for Ent schema directory..."
if [ -d "ent/schema" ]; then
echo "Generating Ent code..."
go install entgo.io/ent/cmd/ent@latest go install entgo.io/ent/cmd/ent@latest
cd ent && go run -mod=mod entgo.io/ent/cmd/ent generate ./schema cd ent/schema && go run -mod=mod entgo.io/ent/cmd/ent generate .
mkdir -p ../internal/ent echo "Copying Ent code to internal/ent..."
cd .. && mkdir -p ../internal/ent
cp -r *.go */ ../internal/ent/ 2>/dev/null || true cp -r *.go */ ../internal/ent/ 2>/dev/null || true
rm -f ../internal/ent/generate.go rm -f ../internal/ent/generate.go
rm -rf ../internal/ent/schema
echo "Verifying internal/ent/ent.go exists..."
ls -la ../internal/ent/ent.go || echo "ERROR: ent.go not found!"
else
echo "WARNING: ent/schema directory not found!"
fi fi
- name: Build - name: Build

6
.gitignore vendored
View File

@@ -69,7 +69,9 @@ Thumbs.db
# Generated protobuf files # Generated protobuf files
api/proto/generated/ api/proto/generated/
# Generated Ent ORM files # Generated Ent ORM files (but keep schema source files)
internal/ent/ internal/ent/
ent/ ent/*.go
ent/*/
!ent/schema/
git.dcentral.systems/ git.dcentral.systems/

19
ent/schema/auditlog.go Normal file
View File

@@ -0,0 +1,19 @@
// Package schema defines the Ent schema for audit log entities.
package schema
import "entgo.io/ent"
// AuditLog holds the schema definition for the AuditLog entity.
type AuditLog struct {
ent.Schema
}
// Fields of the AuditLog.
func (AuditLog) Fields() []ent.Field {
return nil
}
// Edges of the AuditLog.
func (AuditLog) Edges() []ent.Edge {
return nil
}

18
ent/schema/permission.go Normal file
View File

@@ -0,0 +1,18 @@
package schema
import "entgo.io/ent"
// Permission holds the schema definition for the Permission entity.
type Permission struct {
ent.Schema
}
// Fields of the Permission.
func (Permission) Fields() []ent.Field {
return nil
}
// Edges of the Permission.
func (Permission) Edges() []ent.Edge {
return nil
}

18
ent/schema/role.go Normal file
View File

@@ -0,0 +1,18 @@
package schema
import "entgo.io/ent"
// Role holds the schema definition for the Role entity.
type Role struct {
ent.Schema
}
// Fields of the Role.
func (Role) Fields() []ent.Field {
return nil
}
// Edges of the Role.
func (Role) Edges() []ent.Edge {
return nil
}

18
ent/schema/user.go Normal file
View File

@@ -0,0 +1,18 @@
package schema
import "entgo.io/ent"
// User holds the schema definition for the User entity.
type User struct {
ent.Schema
}
// Fields of the User.
func (User) Fields() []ent.Field {
return nil
}
// Edges of the User.
func (User) Edges() []ent.Edge {
return nil
}