Compare commits
4 Commits
7b51100ab6
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8262cd2f61 | ||
|
|
83441b6c69 | ||
|
|
283ca4f148 | ||
|
|
7a3e2167c2 |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -61,6 +61,7 @@ jobs:
|
|||||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }}
|
JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }}
|
||||||
|
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
|
||||||
QA_ADMIN_PORT: ${{ vars.QA_ADMIN_PORT }}
|
QA_ADMIN_PORT: ${{ vars.QA_ADMIN_PORT }}
|
||||||
steps:
|
steps:
|
||||||
# actions/checkout@v4 is a Node-based action; this runner has no node
|
# actions/checkout@v4 is a Node-based action; this runner has no node
|
||||||
@@ -81,6 +82,7 @@ jobs:
|
|||||||
runs-on: [self-hosted, qa]
|
runs-on: [self-hosted, qa]
|
||||||
env:
|
env:
|
||||||
QA_ADMIN_PORT: ${{ vars.QA_ADMIN_PORT }}
|
QA_ADMIN_PORT: ${{ vars.QA_ADMIN_PORT }}
|
||||||
|
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
|
||||||
steps:
|
steps:
|
||||||
# actions/checkout@v4 is a Node-based action; this runner has no node
|
# actions/checkout@v4 is a Node-based action; this runner has no node
|
||||||
# in PATH, so checkout plain git instead of via marketplace action.
|
# in PATH, so checkout plain git instead of via marketplace action.
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
<File Path=".editorconfig" />
|
<File Path=".editorconfig" />
|
||||||
<File Path=".gitignore" />
|
<File Path=".gitignore" />
|
||||||
<File Path="CLAUDE.md" />
|
<File Path="CLAUDE.md" />
|
||||||
<File Path="docker-compose.yml" />
|
|
||||||
<File Path="readme.md" />
|
<File Path="readme.md" />
|
||||||
</Folder>
|
</Folder>
|
||||||
<Folder Name="/src/">
|
<Folder Name="/src/">
|
||||||
|
|||||||
@@ -123,7 +123,7 @@
|
|||||||
|
|
||||||
<text x="53" y="15" fill="#010101" fill-opacity=".3">Coverage</text>
|
<text x="53" y="15" fill="#010101" fill-opacity=".3">Coverage</text>
|
||||||
<text x="53" y="14" fill="#fff">Coverage</text>
|
<text x="53" y="14" fill="#fff">Coverage</text>
|
||||||
<text class="" x="132.5" y="15" fill="#010101" fill-opacity=".3">69.2%</text><text class="" x="132.5" y="14">69.2%</text>
|
<text class="" x="132.5" y="15" fill="#010101" fill-opacity=".3">68.9%</text><text class="" x="132.5" y="14">68.9%</text>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
@@ -9,4 +9,5 @@ REGISTRY_TOKEN=changeme
|
|||||||
|
|
||||||
# QA environment
|
# QA environment
|
||||||
JWT_SECRET_KEY=change-this-to-a-random-32-plus-char-secret
|
JWT_SECRET_KEY=change-this-to-a-random-32-plus-char-secret
|
||||||
|
POSTGRES_PASSWORD=change-this-to-a-random-password
|
||||||
QA_ADMIN_PORT=3001
|
QA_ADMIN_PORT=3001
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: miccheck
|
POSTGRES_DB: miccheck
|
||||||
POSTGRES_USER: miccheck
|
POSTGRES_USER: miccheck
|
||||||
POSTGRES_PASSWORD: password
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
|
||||||
ports:
|
ports:
|
||||||
- "${DB_BIND_HOST:-127.0.0.1}:55432:5432"
|
- "${DB_BIND_HOST:-127.0.0.1}:55432:5432"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -31,7 +31,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
ASPNETCORE_ENVIRONMENT: Development
|
ASPNETCORE_ENVIRONMENT: Development
|
||||||
ASPNETCORE_URLS: http://+:8080
|
ASPNETCORE_URLS: http://+:8080
|
||||||
ConnectionStrings__miccheck: "Host=db;Database=miccheck;Username=miccheck;Password=password"
|
ConnectionStrings__miccheck: "Host=db;Database=miccheck;Username=miccheck;Password=${POSTGRES_PASSWORD}"
|
||||||
Jwt__SecretKey: ${JWT_SECRET_KEY}
|
Jwt__SecretKey: ${JWT_SECRET_KEY}
|
||||||
Jwt__Issuer: MicCheck
|
Jwt__Issuer: MicCheck
|
||||||
Jwt__Audience: MicCheck
|
Jwt__Audience: MicCheck
|
||||||
|
|||||||
34
dev-build.sh
34
dev-build.sh
@@ -3,27 +3,19 @@ set -e
|
|||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
build_api() {
|
echo "Building solution..."
|
||||||
echo "Building API..."
|
dotnet build "$SCRIPT_DIR/MicCheck.slnx"
|
||||||
dotnet publish "$SCRIPT_DIR/src/api/MicCheck.Api/MicCheck.Api.csproj" -c Release -o "$SCRIPT_DIR/src/api/MicCheck.Api/publish"
|
|
||||||
docker compose -f "$SCRIPT_DIR/docker-compose.yml" restart api
|
|
||||||
echo "API done."
|
|
||||||
}
|
|
||||||
|
|
||||||
build_admin() {
|
echo "Installing admin dependencies..."
|
||||||
echo "Building admin..."
|
|
||||||
npm --prefix "$SCRIPT_DIR/src/admin" ci --silent
|
npm --prefix "$SCRIPT_DIR/src/admin" ci --silent
|
||||||
npm --prefix "$SCRIPT_DIR/src/admin" run build
|
|
||||||
docker compose -f "$SCRIPT_DIR/docker-compose.yml" restart admin
|
|
||||||
echo "Admin done."
|
|
||||||
}
|
|
||||||
|
|
||||||
case "${1:-all}" in
|
echo "Building admin..."
|
||||||
api) build_api ;;
|
npm --prefix "$SCRIPT_DIR/src/admin" run build
|
||||||
admin) build_admin ;;
|
|
||||||
all) build_api && build_admin ;;
|
echo "Running .NET unit tests..."
|
||||||
*)
|
dotnet test "$SCRIPT_DIR/tests/api/MicCheck.Api.Tests.Unit/MicCheck.Api.Tests.Unit.csproj"
|
||||||
echo "Usage: $0 [api|admin|all]"
|
|
||||||
exit 1
|
echo "Running Jest tests..."
|
||||||
;;
|
npm --prefix "$SCRIPT_DIR/src/admin" test
|
||||||
esac
|
|
||||||
|
echo "Build and tests complete."
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
services:
|
|
||||||
|
|
||||||
# ── PostgreSQL ───────────────────────────────────────────────────────────────
|
|
||||||
db:
|
|
||||||
image: postgres:16-alpine
|
|
||||||
environment:
|
|
||||||
POSTGRES_DB: miccheck
|
|
||||||
POSTGRES_USER: miccheck
|
|
||||||
POSTGRES_PASSWORD: password
|
|
||||||
ports:
|
|
||||||
- "5432:5432"
|
|
||||||
volumes:
|
|
||||||
- postgres_data:/var/lib/postgresql/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready -U miccheck -d miccheck"]
|
|
||||||
interval: 5s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 10
|
|
||||||
|
|
||||||
# ── .NET API ─────────────────────────────────────────────────────────────────
|
|
||||||
api:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: src/api/MicCheck.Api/Dockerfile
|
|
||||||
ports:
|
|
||||||
- "8080:8080"
|
|
||||||
volumes:
|
|
||||||
- ./src/api/MicCheck.Api/publish:/app
|
|
||||||
environment:
|
|
||||||
ASPNETCORE_ENVIRONMENT: Development
|
|
||||||
ASPNETCORE_URLS: http://+:8080
|
|
||||||
ConnectionStrings__DefaultConnection: "Host=db;Database=miccheck;Username=miccheck;Password=password"
|
|
||||||
Jwt__SecretKey: "miccheck-dev-secret-key-change-in-production!!"
|
|
||||||
Jwt__Issuer: MicCheck
|
|
||||||
Jwt__Audience: MicCheck
|
|
||||||
depends_on:
|
|
||||||
db:
|
|
||||||
condition: service_healthy
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/api/v1/health 2>/dev/null || exit 0"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
start_period: 20s
|
|
||||||
|
|
||||||
# ── Vue Admin Site (nginx) ───────────────────────────────────────────────────
|
|
||||||
admin:
|
|
||||||
build:
|
|
||||||
context: src/admin
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
ports:
|
|
||||||
- "3000:80"
|
|
||||||
volumes:
|
|
||||||
- ./src/admin/dist:/usr/share/nginx/html
|
|
||||||
depends_on:
|
|
||||||
api:
|
|
||||||
condition: service_started
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
postgres_data:
|
|
||||||
@@ -29,10 +29,11 @@ Code in the API is organized by feature area (e.g. `Features`, `Segments`, `Iden
|
|||||||
|
|
||||||
## Running locally
|
## Running locally
|
||||||
|
|
||||||
`docker-compose.yml` provides supporting services. `MicCheck.AppHost` (.NET Aspire) orchestrates the API and admin app for local development.
|
`MicCheck.AppHost` (.NET Aspire) orchestrates the API, admin app, and supporting services for local development.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./dev-build.sh
|
./dev-build.sh
|
||||||
|
aspire run --project src/MicCheck.AppHost
|
||||||
```
|
```
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ registry_login
|
|||||||
|
|
||||||
export API_IMAGE ADMIN_IMAGE
|
export API_IMAGE ADMIN_IMAGE
|
||||||
export JWT_SECRET_KEY="${JWT_SECRET_KEY:?JWT_SECRET_KEY env var is required}"
|
export JWT_SECRET_KEY="${JWT_SECRET_KEY:?JWT_SECRET_KEY env var is required}"
|
||||||
|
export POSTGRES_PASSWORD="${POSTGRES_PASSWORD:?POSTGRES_PASSWORD env var is required}"
|
||||||
export QA_ADMIN_PORT="${QA_ADMIN_PORT:-3001}"
|
export QA_ADMIN_PORT="${QA_ADMIN_PORT:-3001}"
|
||||||
|
|
||||||
# Bind narrowly to docker's bridge gateway IP rather than 0.0.0.0: reachable
|
# Bind narrowly to docker's bridge gateway IP rather than 0.0.0.0: reachable
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ BASE_URL="http://${CI_HOST}:${QA_ADMIN_PORT}"
|
|||||||
log "Resolved docker host as $CI_HOST for reaching the QA stack's published ports"
|
log "Resolved docker host as $CI_HOST for reaching the QA stack's published ports"
|
||||||
|
|
||||||
export MICCHECK_API_BASE_URL="$BASE_URL"
|
export MICCHECK_API_BASE_URL="$BASE_URL"
|
||||||
export MICCHECK_DB_CONNECTION_STRING="${MICCHECK_DB_CONNECTION_STRING:-Host=$CI_HOST;Port=55432;Database=miccheck;Username=miccheck;Password=password}"
|
export MICCHECK_DB_CONNECTION_STRING="${MICCHECK_DB_CONNECTION_STRING:-Host=$CI_HOST;Port=55432;Database=miccheck;Username=miccheck;Password=${POSTGRES_PASSWORD:?POSTGRES_PASSWORD env var is required}}"
|
||||||
|
|
||||||
log "Running API integration suite against $BASE_URL"
|
log "Running API integration suite against $BASE_URL"
|
||||||
dotnet test tests/api/MicCheck.Api.Tests.Integration/MicCheck.Api.Tests.Integration.csproj -c Release --logger trx
|
dotnet test tests/api/MicCheck.Api.Tests.Integration/MicCheck.Api.Tests.Integration.csproj -c Release --logger trx
|
||||||
|
|||||||
Reference in New Issue
Block a user