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
42 changes: 42 additions & 0 deletions .azuredevops/android-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: $(Date:yyMMdd).00.$(Rev:r)

trigger:
branches:
include:
- main
paths:
include:
- android/**

pr:
branches:
include:
- main
paths:
include:
- android/**

resources:
repositories:
- repository: templates
type: github
name: dkhalife/Pipeline.Templates
endpoint: github
ref: refs/tags/latest

extends:
template: pipeline.yml@templates
parameters:
stages:
- stage: build
templateContext:
intent: build
jobs:
- job: app
templateContext:
android:
- name: android
jdkVersion: '21'
workingDirectory: android
gradleTasks: assembleDebug
sign: false
Comment thread
dkhalife marked this conversation as resolved.
48 changes: 48 additions & 0 deletions .azuredevops/api-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: $(Date:yyMMdd).00.$(Rev:r)

trigger:
branches:
include:
- main
paths:
include:
- apiserver/**

pr:
branches:
include:
- main
paths:
include:
- apiserver/**

resources:
repositories:
- repository: templates
type: github
name: dkhalife/Pipeline.Templates
endpoint: github
ref: refs/tags/latest

extends:
template: pipeline.yml@templates
parameters:
stages:
- stage: build
templateContext:
intent: build
jobs:
- job: app
templateContext:
go:
- name: api
goVersion: '1.25'
workingDirectory: apiserver
buildArgs: >-
-v
-ldflags "-X dkhalife.com/tasks/core/internal/version.Version=$(Build.BuildNumber)
-X dkhalife.com/tasks/core/internal/version.BuildNumber=0
-X dkhalife.com/tasks/core/internal/version.CommitHash=$(Build.SourceVersion)"
./...
testArgs: '-v -coverprofile=coverage.txt ./...'
vet: false
Comment thread
dkhalife marked this conversation as resolved.
43 changes: 43 additions & 0 deletions .azuredevops/frontend-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: $(Date:yyMMdd).00.$(Rev:r)

trigger:
branches:
include:
- main
paths:
include:
- frontend/**

pr:
branches:
include:
- main
paths:
include:
- frontend/**

resources:
repositories:
- repository: templates
type: github
name: dkhalife/Pipeline.Templates
endpoint: github
ref: refs/tags/latest

extends:
template: pipeline.yml@templates
parameters:
stages:
- stage: build
templateContext:
intent: build
jobs:
- job: app
container: mcr.microsoft.com/playwright:v1.55.1-noble
templateContext:
node:
- name: frontend
nodeVersion: 24.x
workingDirectory: frontend
e2e: true
e2eReportPath: frontend/playwright-report
Comment thread
dkhalife marked this conversation as resolved.
Comment thread
dkhalife marked this conversation as resolved.
42 changes: 42 additions & 0 deletions .azuredevops/mcp-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: $(Date:yyMMdd).00.$(Rev:r)

trigger:
branches:
include:
- main
paths:
include:
- mcpserver/**

pr:
branches:
include:
- main
paths:
include:
- mcpserver/**

resources:
repositories:
- repository: templates
type: github
name: dkhalife/Pipeline.Templates
endpoint: github
ref: refs/tags/latest

extends:
template: pipeline.yml@templates
parameters:
stages:
- stage: build
templateContext:
intent: build
jobs:
- job: app
templateContext:
dotnet:
- name: mcp
sdkVersion: '9.x'
projects: mcpserver/**/*.csproj
configuration: Release
test: false
Comment thread
dkhalife marked this conversation as resolved.
Empty file modified android/gradlew
100644 → 100755
Empty file.
76 changes: 38 additions & 38 deletions apiserver/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ func TestLoadConfig_Success(t *testing.T) {
f, err := os.Create("./config/config.yaml")
assert.NoError(t, err, "failed to create config.yaml")

defer os.Remove("./config/config.yaml")
defer f.Close()
defer func() { _ = os.Remove("./config/config.yaml") }()
defer func() { _ = f.Close() }()
_, err = f.WriteString(`server:
port: 1234
log_level: debug
Expand Down Expand Up @@ -112,8 +112,8 @@ func TestLoadConfig_EntraEnvOverride(t *testing.T) {
_ = os.MkdirAll("./config", 0755)
f, err := os.Create("./config/config.yaml")
assert.NoError(t, err)
defer os.Remove("./config/config.yaml")
defer f.Close()
defer func() { _ = os.Remove("./config/config.yaml") }()
defer func() { _ = f.Close() }()

_, err = f.WriteString(`entra:
enabled: false
Expand All @@ -125,10 +125,10 @@ server:
`)
assert.NoError(t, err)

os.Setenv("TW_ENTRA_ENABLED", "true")
os.Setenv("TW_ENTRA_TENANT_ID", "env-tenant")
os.Setenv("TW_ENTRA_CLIENT_ID", "env-client")
os.Setenv("TW_ENTRA_AUDIENCE", "api://env-client")
_ = os.Setenv("TW_ENTRA_ENABLED", "true")
_ = os.Setenv("TW_ENTRA_TENANT_ID", "env-tenant")
_ = os.Setenv("TW_ENTRA_CLIENT_ID", "env-client")
_ = os.Setenv("TW_ENTRA_AUDIENCE", "api://env-client")

Comment thread
dkhalife marked this conversation as resolved.
viper.Reset()
cfg := LoadConfig("./config/config.yaml")
Expand All @@ -138,56 +138,56 @@ server:
assert.Equal(t, "env-client", cfg.Entra.ClientID)
assert.Equal(t, "api://env-client", cfg.Entra.Audience)

os.Unsetenv("TW_ENTRA_ENABLED")
os.Unsetenv("TW_ENTRA_TENANT_ID")
os.Unsetenv("TW_ENTRA_CLIENT_ID")
os.Unsetenv("TW_ENTRA_AUDIENCE")
_ = os.Unsetenv("TW_ENTRA_ENABLED")
_ = os.Unsetenv("TW_ENTRA_TENANT_ID")
_ = os.Unsetenv("TW_ENTRA_CLIENT_ID")
_ = os.Unsetenv("TW_ENTRA_AUDIENCE")
Comment thread
dkhalife marked this conversation as resolved.
}

func TestLoadConfig_EnvFile(t *testing.T) {
f, err := os.Create("envconfig.yaml")
assert.NoError(t, err)
defer os.Remove("envconfig.yaml")
defer f.Close()
defer func() { _ = os.Remove("envconfig.yaml") }()
defer func() { _ = f.Close() }()

_, err = f.WriteString("server:\n port: 4444\n")
assert.NoError(t, err)

os.Setenv("TW_CONFIG_FILE", "envconfig.yaml")
_ = os.Setenv("TW_CONFIG_FILE", "envconfig.yaml")
viper.Reset()
cfg := LoadConfig("")
assert.Equal(t, 4444, cfg.Server.Port)
os.Unsetenv("TW_CONFIG_FILE")
_ = os.Unsetenv("TW_CONFIG_FILE")
}

func TestLoadConfig_CLIOverridesEnv(t *testing.T) {
f1, err := os.Create("env.yaml")
assert.NoError(t, err)
defer os.Remove("env.yaml")
defer f1.Close()
defer func() { _ = os.Remove("env.yaml") }()
defer func() { _ = f1.Close() }()
_, err = f1.WriteString("server:\n port: 3333\n")
assert.NoError(t, err)

f2, err := os.Create("cli.yaml")
assert.NoError(t, err)
defer os.Remove("cli.yaml")
defer f2.Close()
defer func() { _ = os.Remove("cli.yaml") }()
defer func() { _ = f2.Close() }()
_, err = f2.WriteString("server:\n port: 2222\n")
assert.NoError(t, err)

os.Setenv("TW_CONFIG_FILE", "env.yaml")
_ = os.Setenv("TW_CONFIG_FILE", "env.yaml")
viper.Reset()
cfg := LoadConfig("cli.yaml")
assert.Equal(t, 2222, cfg.Server.Port)
os.Unsetenv("TW_CONFIG_FILE")
_ = os.Unsetenv("TW_CONFIG_FILE")
}

func TestLoadConfig_DatabaseEnvOverride(t *testing.T) {
_ = os.MkdirAll("./config", 0755)
f, err := os.Create("./config/config.yaml")
assert.NoError(t, err)
defer os.Remove("./config/config.yaml")
defer f.Close()
defer func() { _ = os.Remove("./config/config.yaml") }()
defer func() { _ = f.Close() }()

_, err = f.WriteString(`database:
type: sqlite
Expand All @@ -197,12 +197,12 @@ server:
`)
assert.NoError(t, err)

os.Setenv("TW_DATABASE_TYPE", "mysql")
os.Setenv("TW_DATABASE_HOST", "localhost")
os.Setenv("TW_DATABASE_PORT", "3307")
os.Setenv("TW_DATABASE_NAME", "taskwizard")
os.Setenv("TW_DATABASE_USERNAME", "dbuser")
os.Setenv("TW_DATABASE_PASSWORD", "dbpass")
_ = os.Setenv("TW_DATABASE_TYPE", "mysql")
_ = os.Setenv("TW_DATABASE_HOST", "localhost")
_ = os.Setenv("TW_DATABASE_PORT", "3307")
_ = os.Setenv("TW_DATABASE_NAME", "taskwizard")
_ = os.Setenv("TW_DATABASE_USERNAME", "dbuser")
_ = os.Setenv("TW_DATABASE_PASSWORD", "dbpass")

viper.Reset()
cfg := LoadConfig("./config/config.yaml")
Expand All @@ -214,20 +214,20 @@ server:
assert.Equal(t, "dbuser", cfg.Database.Username)
assert.Equal(t, "dbpass", cfg.Database.Password)

os.Unsetenv("TW_DATABASE_TYPE")
os.Unsetenv("TW_DATABASE_HOST")
os.Unsetenv("TW_DATABASE_PORT")
os.Unsetenv("TW_DATABASE_NAME")
os.Unsetenv("TW_DATABASE_USERNAME")
os.Unsetenv("TW_DATABASE_PASSWORD")
_ = os.Unsetenv("TW_DATABASE_TYPE")
_ = os.Unsetenv("TW_DATABASE_HOST")
_ = os.Unsetenv("TW_DATABASE_PORT")
_ = os.Unsetenv("TW_DATABASE_NAME")
_ = os.Unsetenv("TW_DATABASE_USERNAME")
_ = os.Unsetenv("TW_DATABASE_PASSWORD")
}

func TestLoadConfig_MySQLConfig(t *testing.T) {
_ = os.MkdirAll("./config", 0755)
f, err := os.Create("./config/config.yaml")
assert.NoError(t, err)
defer os.Remove("./config/config.yaml")
defer f.Close()
defer func() { _ = os.Remove("./config/config.yaml") }()
defer func() { _ = f.Close() }()

_, err = f.WriteString(`database:
type: mysql
Expand Down
2 changes: 1 addition & 1 deletion apiserver/internal/migrations/001_initial_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (m *InitialSchemaMigration) Name() string {
}

func (m *InitialSchemaMigration) Up(ctx context.Context, db *gorm.DB) error {
dialect := db.Dialector.Name()
dialect := db.Name()
Comment thread
dkhalife marked this conversation as resolved.

var (
autoInc string
Expand Down
4 changes: 2 additions & 2 deletions apiserver/internal/migrations/002_entra_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (m *EntraAuthMigration) Name() string {
func (m *EntraAuthMigration) Up(ctx context.Context, db *gorm.DB) error {
dbCtx := db.WithContext(ctx)
migrator := dbCtx.Migrator()
dialect := db.Dialector.Name()
dialect := db.Name()
Comment thread
dkhalife marked this conversation as resolved.

var colType string
switch dialect {
Expand Down Expand Up @@ -88,7 +88,7 @@ func (m *EntraAuthMigration) Up(ctx context.Context, db *gorm.DB) error {
func (m *EntraAuthMigration) Down(ctx context.Context, db *gorm.DB) error {
dbCtx := db.WithContext(ctx)
migrator := dbCtx.Migrator()
dialect := db.Dialector.Name()
dialect := db.Name()
Comment thread
dkhalife marked this conversation as resolved.

if migrator.HasIndex("users", "idx_users_entra_id") {
if err := migrator.DropIndex("users", "idx_users_entra_id"); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion apiserver/internal/migrations/003_drop_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (m *DropPasswordMigration) Up(ctx context.Context, db *gorm.DB) error {
func (m *DropPasswordMigration) Down(ctx context.Context, db *gorm.DB) error {
dbCtx := db.WithContext(ctx)
migrator := dbCtx.Migrator()
dialect := db.Dialector.Name()
dialect := db.Name()
Comment thread
dkhalife marked this conversation as resolved.

if !migrator.HasColumn("users", "password") {
var colType string
Expand Down
2 changes: 1 addition & 1 deletion apiserver/internal/migrations/004_drop_app_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (m *DropAppTokensMigration) Up(ctx context.Context, db *gorm.DB) error {
func (m *DropAppTokensMigration) Down(ctx context.Context, db *gorm.DB) error {
dbCtx := db.WithContext(ctx)
migrator := dbCtx.Migrator()
dialect := db.Dialector.Name()
dialect := db.Name()
Comment thread
dkhalife marked this conversation as resolved.

if !migrator.HasTable("app_tokens") {
switch dialect {
Expand Down
4 changes: 2 additions & 2 deletions apiserver/internal/migrations/005_drop_email.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (m *DropPIIMigration) Name() string {

func (m *DropPIIMigration) Up(ctx context.Context, db *gorm.DB) error {
dbCtx := db.WithContext(ctx)
dialect := db.Dialector.Name()
dialect := db.Name()
Comment thread
dkhalife marked this conversation as resolved.

switch dialect {
case "sqlite":
Expand Down Expand Up @@ -61,7 +61,7 @@ func (m *DropPIIMigration) Up(ctx context.Context, db *gorm.DB) error {

func (m *DropPIIMigration) Down(ctx context.Context, db *gorm.DB) error {
dbCtx := db.WithContext(ctx)
dialect := db.Dialector.Name()
dialect := db.Name()
Comment thread
dkhalife marked this conversation as resolved.

switch dialect {
case "sqlite":
Expand Down
Loading
Loading