-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
116 lines (89 loc) · 3.6 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
shebang := if os() == 'windows' {
'pwsh -nop'
} else {
'/usr/bin/env pwsh -nop'
}
set shell := ["pwsh", "-nop", "-c"]
solution-root := "TeachingRecordSystem"
user-secrets-id := "TeachingRecordSystem"
test-user-secrets-id := "TeachingRecordSystemTests"
default:
@just --list
# Install local tools
install-tools:
@cd {{solution-root}} && dotnet tool restore
npm install -g sass
# Restore dependencies
restore:
@cd {{solution-root}} && dotnet restore --locked-mode
@cd {{solution-root / "src" / "TeachingRecordSystem.SupportUi" }} && dotnet libman restore --verbosity quiet
@cd {{solution-root / "src" / "TeachingRecordSystem.AuthorizeAccess" }} && dotnet libman restore --verbosity quiet
# Run the trscli
cli *ARGS:
@dotnet {{solution-root / "src" / "TeachingRecordSystem.Cli" / "bin" / "Debug" / "net8.0" / "trscli.dll"}} {{ARGS}}
# Build the .NET solution
build:
@cd {{solution-root}} && dotnet build
# Test the .NET solution
test:
@cd {{solution-root}} && dotnet test
# Format the .NET solution and Terraform code
format:
@cd {{solution-root}} && dotnet format
@terraform fmt terraform/aks
# Format any un-committed .tf or .cs files
format-changed:
#!{{shebang}}
function Get-ChangedFiles {
param (
$Path
)
(git status --porcelain $Path) | foreach { $_.substring(3) } | Where-Object { Test-Path $_ }
}
$changedTfFiles = Get-ChangedFiles "terraform/*.tf"
foreach ($tf in $changedTfFiles) {
terraform fmt $tf
}
$changedCsFiles = (Get-ChangedFiles "{{solution-root}}/**/*.cs") | foreach { $_ -Replace "^{{solution-root}}/", "" }
if ($changedCsFiles.Length -gt 0) {
$dotnetArgs = @("format", "--no-restore", "--include") + $changedCsFiles
cd {{solution-root}} && dotnet $dotnetArgs
}
# Run the EF Core Command-line Tools for the Core project
ef *ARGS:
@cd {{solution-root / "src" / "TeachingRecordSystem.Core"}} && dotnet dotnet-ef {{ARGS}}
# Run the API project in Development mode
run-api:
@cd {{solution-root / "src" / "TeachingRecordSystem.Api"}} && dotnet run
# Run the API project in Development mode and watch for file changes
watch-api:
@cd {{solution-root / "src" / "TeachingRecordSystem.Api"}} && dotnet watch
# Run the AuthorizeAccess project in Development mode and watch for file changes
watch-authz:
@cd {{solution-root / "src" / "TeachingRecordSystem.AuthorizeAccess"}} && dotnet watch
# Run the UI project in Development mode and watch for file changes
watch-ui:
@cd {{solution-root / "src" / "TeachingRecordSystem.SupportUi"}} && dotnet watch
# Run the Worker project in Development mode and watch for file changes
watch-worker:
@cd {{solution-root / "src" / "TeachingRecordSystem.Worker"}} && dotnet watch
# Build the Docker image
docker-build *ARGS: install-tools restore
@cd {{solution-root}} && dotnet publish -c Release --no-restore
@cd {{solution-root}} && docker build . {{ARGS}}
# Set a configuration entry in user secrets for running the apps
set-secret key value:
@dotnet user-secrets set "{{key}}" "{{value}}" --id {{user-secrets-id}}
# Set a configuration entry in user secrets for tests
set-tests-secret key value:
@dotnet user-secrets set "{{key}}" "{{value}}" --id {{test-user-secrets-id}}
create-admin email name:
@cd {{solution-root / "src" / "TeachingRecordSystem.Cli"}} && dotnet {{"bin" / "Debug" / "net8.0" / "trscli.dll"}} create-admin --email {{email}} --name {{quote(name)}}
make *ARGS:
@make {{ARGS}}
# Generates CRM model types
generate-crm-models *ARGS:
@scripts/Generate-CrmModels.ps1 {{ARGS}}
# Removes the cached DB schema version file for tests
remove-tests-schema-cache:
@scripts/Remove-TestsSchemaCache.ps1