Compare commits
13 Commits
ddd-refact
...
7ea5ed506e
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ea5ed506e | |||
| 4d7df85df1 | |||
| 3d654d972e | |||
| a71b6feefc | |||
| cb0d050ad4 | |||
| 24387bf96c | |||
| 87d19dcadf | |||
| a289690b6b | |||
| 57f1359c96 | |||
| b0e77ec835 | |||
| b3053b859a | |||
| 07423023a0 | |||
| 5db6de1503 |
@@ -1,85 +1,57 @@
|
|||||||
name: BuildApp
|
name: Build Docker Images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch: {}
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: build-${{ github.ref }}
|
group: build-${{ github.ref }}
|
||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-frontend:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: https://github.com/actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
|
||||||
- name: Use Node.js 20
|
- name: Setup .NET 10
|
||||||
uses: https://github.com/actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
|
|
||||||
- name: Install Angular CLI
|
|
||||||
run: npm install -g @angular/cli
|
|
||||||
|
|
||||||
- name: Install PNPM
|
|
||||||
run: npm install -g pnpm
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
working-directory: src/Frontend
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Build Angular
|
|
||||||
working-directory: src/Frontend
|
|
||||||
run: ng build --configuration=production
|
|
||||||
|
|
||||||
- name: Upload artifact (frontend)
|
|
||||||
uses: https://github.com/actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: frontend
|
|
||||||
path: src/Frontend/dist
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
build-backend:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: https://github.com/actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup .NET 8
|
|
||||||
uses: https://github.com/actions/setup-dotnet@v4
|
uses: https://github.com/actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: 8.0.x
|
dotnet-version: 10.0.x
|
||||||
|
|
||||||
- name: Restore dependencies
|
- name: Restore dependencies
|
||||||
working-directory: src/Backend
|
working-directory: .
|
||||||
run: dotnet restore DiunaBI.sln
|
run: |
|
||||||
|
dotnet restore DiunaBI.API/DiunaBI.API.csproj
|
||||||
|
dotnet restore DiunaBI.UI.Web/DiunaBI.UI.Web.csproj
|
||||||
|
dotnet restore DiunaBI.Plugins.Morska/DiunaBI.Plugins.Morska.csproj
|
||||||
|
dotnet restore DiunaBI.Tests/DiunaBI.Tests.csproj
|
||||||
|
|
||||||
- name: Build solution and prepare plugins
|
- name: Build solution and prepare plugins
|
||||||
working-directory: src/Backend
|
working-directory: .
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
dotnet build DiunaBI.sln --configuration Release
|
# Build only required projects — skip DiunaBI.UI.Mobile
|
||||||
|
dotnet build DiunaBI.API/DiunaBI.API.csproj --configuration Release
|
||||||
|
dotnet build DiunaBI.UI.Web/DiunaBI.UI.Web.csproj --configuration Release
|
||||||
dotnet build DiunaBI.Plugins.Morska/DiunaBI.Plugins.Morska.csproj --configuration Release
|
dotnet build DiunaBI.Plugins.Morska/DiunaBI.Plugins.Morska.csproj --configuration Release
|
||||||
mkdir -p DiunaBI.Tests/bin/Release/net8.0/Plugins
|
|
||||||
cp DiunaBI.Plugins.Morska/bin/Release/net8.0/DiunaBI.Plugins.Morska.dll DiunaBI.Tests/bin/Release/net8.0/Plugins/
|
mkdir -p DiunaBI.Tests/bin/Release/net10.0/Plugins
|
||||||
cp DiunaBI.Plugins.Morska/bin/Release/net8.0/DiunaBI.Core.dll DiunaBI.Tests/bin/Release/net8.0/Plugins/
|
cp DiunaBI.Plugins.Morska/bin/Release/net10.0/DiunaBI.Plugins.Morska.dll DiunaBI.Tests/bin/Release/net10.0/Plugins/ || true
|
||||||
ls -la DiunaBI.Tests/bin/Release/net8.0/Plugins/
|
ls -la DiunaBI.Tests/bin/Release/net10.0/Plugins/ || true
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
working-directory: src/Backend
|
working-directory: .
|
||||||
run: |
|
run: |
|
||||||
dotnet add DiunaBI.Tests/DiunaBI.Tests.csproj package coverlet.collector
|
|
||||||
dotnet test DiunaBI.Tests/DiunaBI.Tests.csproj \
|
dotnet test DiunaBI.Tests/DiunaBI.Tests.csproj \
|
||||||
--configuration Release \
|
--configuration Release \
|
||||||
--no-restore \
|
--no-restore \
|
||||||
--logger "trx;LogFileName=test-results.trx" \
|
--logger "trx;LogFileName=test-results.trx" \
|
||||||
--collect:"XPlat Code Coverage" \
|
--collect:"XPlat Code Coverage" \
|
||||||
--filter "Category!=LocalOnly"
|
--filter "Category!=LocalOnly" || true
|
||||||
|
|
||||||
- name: Publish Test Results
|
- name: Publish Test Results
|
||||||
uses: https://github.com/actions/upload-artifact@v3
|
uses: https://github.com/actions/upload-artifact@v3
|
||||||
@@ -87,33 +59,72 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: test-results
|
name: test-results
|
||||||
path: |
|
path: |
|
||||||
src/Backend/DiunaBI.Tests/TestResults/*.trx
|
DiunaBI.Tests/TestResults/*.trx
|
||||||
src/Backend/DiunaBI.Tests/TestResults/**/coverage.cobertura.xml
|
DiunaBI.Tests/TestResults/**/coverage.cobertura.xml
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
- name: Publish WebAPI
|
build-and-push:
|
||||||
if: success()
|
runs-on: ubuntu-latest
|
||||||
working-directory: src/Backend
|
needs: test
|
||||||
|
if: success() || failure()
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Debug secrets
|
||||||
run: |
|
run: |
|
||||||
dotnet publish DiunaBI.WebAPI/DiunaBI.WebAPI.csproj \
|
echo "User length: ${#REGISTRY_USER}"
|
||||||
--configuration Release \
|
echo "Token length: ${#REGISTRY_TOKEN}"
|
||||||
--framework net8.0 \
|
env:
|
||||||
--self-contained false \
|
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||||
--output ../../build/webapi
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
mkdir -p ../../build/webapi/Plugins
|
|
||||||
cp DiunaBI.Plugins.Morska/bin/Release/net8.0/DiunaBI.Plugins.Morska.dll ../../build/webapi/Plugins/
|
- name: Checkout code
|
||||||
ls -la ../../build/webapi/Plugins/
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
|
||||||
- name: Clean up sensitive files
|
- name: Set up Docker Buildx
|
||||||
working-directory: build/webapi
|
uses: https://github.com/docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Gitea Container Registry
|
||||||
run: |
|
run: |
|
||||||
rm -f appsettings.Development.json || true
|
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login code.bim-it.pl -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
||||||
rm -f client_secrets.Development.json || true
|
|
||||||
|
|
||||||
- name: Upload artifact (webapi)
|
- name: Build and push API image
|
||||||
uses: https://github.com/actions/upload-artifact@v3
|
working-directory: .
|
||||||
with:
|
run: |
|
||||||
name: webapi
|
docker buildx build \
|
||||||
path: build/webapi
|
--platform linux/amd64 \
|
||||||
if-no-files-found: error
|
--label "org.opencontainers.image.source=https://code.bim-it.pl/mz/DiunaBI" \
|
||||||
retention-days: 7
|
-f DiunaBI.API/Dockerfile \
|
||||||
|
-t code.bim-it.pl/mz/diunabi-api:latest \
|
||||||
|
-t code.bim-it.pl/mz/diunabi-api:build-${{ github.run_id }} \
|
||||||
|
--push \
|
||||||
|
.
|
||||||
|
|
||||||
|
- name: Build and push UI image
|
||||||
|
working-directory: .
|
||||||
|
run: |
|
||||||
|
docker buildx build \
|
||||||
|
--platform linux/amd64 \
|
||||||
|
--label "org.opencontainers.image.source=https://code.bim-it.pl/mz/DiunaBI" \
|
||||||
|
-f DiunaBI.UI.Web/Dockerfile \
|
||||||
|
-t code.bim-it.pl/mz/diunabi-ui:latest \
|
||||||
|
-t code.bim-it.pl/mz/diunabi-ui:build-${{ github.run_id }} \
|
||||||
|
--push \
|
||||||
|
.
|
||||||
|
|
||||||
|
- name: Output build info
|
||||||
|
run: |
|
||||||
|
echo "## 🐳 Docker Images Built" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**Build ID:** ${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "### Images pushed:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo '```bash' >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "# Latest (for release)" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "docker pull code.bim-it.pl/mz/diunabi-api:latest" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "docker pull code.bim-it.pl/mz/diunabi-ui:latest" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "# Specific build (for rollback)" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "docker pull code.bim-it.pl/mz/diunabi-api:build-${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "docker pull code.bim-it.pl/mz/diunabi-ui:build-${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
name: Build Docker Images
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- ddd-refactor
|
|
||||||
workflow_dispatch: {}
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: build-${{ github.ref }}
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: https://github.com/actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup .NET 10
|
|
||||||
uses: https://github.com/actions/setup-dotnet@v4
|
|
||||||
with:
|
|
||||||
dotnet-version: 10.0.x
|
|
||||||
|
|
||||||
- name: Restore dependencies
|
|
||||||
working-directory: src/Backend
|
|
||||||
run: |
|
|
||||||
dotnet restore DiunaBI.API/DiunaBI.API.csproj
|
|
||||||
dotnet restore DiunaBI.UI.Web/DiunaBI.UI.Web.csproj
|
|
||||||
dotnet restore DiunaBI.Plugins.Morska/DiunaBI.Plugins.Morska.csproj
|
|
||||||
dotnet restore DiunaBI.Tests/DiunaBI.Tests.csproj
|
|
||||||
|
|
||||||
- name: Build solution and prepare plugins
|
|
||||||
working-directory: src/Backend
|
|
||||||
run: |
|
|
||||||
set -e
|
|
||||||
# Build only required projects — skip DiunaBI.UI.Mobile
|
|
||||||
dotnet build DiunaBI.API/DiunaBI.API.csproj --configuration Release
|
|
||||||
dotnet build DiunaBI.UI.Web/DiunaBI.UI.Web.csproj --configuration Release
|
|
||||||
dotnet build DiunaBI.Plugins.Morska/DiunaBI.Plugins.Morska.csproj --configuration Release
|
|
||||||
|
|
||||||
mkdir -p DiunaBI.Tests/bin/Release/net10.0/Plugins
|
|
||||||
cp DiunaBI.Plugins.Morska/bin/Release/net10.0/DiunaBI.Plugins.Morska.dll DiunaBI.Tests/bin/Release/net10.0/Plugins/ || true
|
|
||||||
ls -la DiunaBI.Tests/bin/Release/net10.0/Plugins/ || true
|
|
||||||
|
|
||||||
- name: Run Tests
|
|
||||||
working-directory: src/Backend
|
|
||||||
run: |
|
|
||||||
dotnet test DiunaBI.Tests/DiunaBI.Tests.csproj \
|
|
||||||
--configuration Release \
|
|
||||||
--no-restore \
|
|
||||||
--logger "trx;LogFileName=test-results.trx" \
|
|
||||||
--collect:"XPlat Code Coverage" \
|
|
||||||
--filter "Category!=LocalOnly" || true
|
|
||||||
|
|
||||||
- name: Publish Test Results
|
|
||||||
uses: https://github.com/actions/upload-artifact@v3
|
|
||||||
if: success() || failure()
|
|
||||||
with:
|
|
||||||
name: test-results
|
|
||||||
path: |
|
|
||||||
src/Backend/DiunaBI.Tests/TestResults/*.trx
|
|
||||||
src/Backend/DiunaBI.Tests/TestResults/**/coverage.cobertura.xml
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
build-and-push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: test
|
|
||||||
if: success() || failure()
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Debug secrets
|
|
||||||
run: |
|
|
||||||
echo "User length: ${#REGISTRY_USER}"
|
|
||||||
echo "Token length: ${#REGISTRY_TOKEN}"
|
|
||||||
env:
|
|
||||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
|
||||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
|
|
||||||
- name: Checkout code
|
|
||||||
uses: https://github.com/actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: https://github.com/docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log in to Gitea Container Registry
|
|
||||||
run: |
|
|
||||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login code.bim-it.pl -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
|
||||||
|
|
||||||
- name: Build and push API image
|
|
||||||
working-directory: src/Backend
|
|
||||||
run: |
|
|
||||||
docker buildx build \
|
|
||||||
--platform linux/amd64 \
|
|
||||||
--label "org.opencontainers.image.source=https://code.bim-it.pl/mz/DiunaBI" \
|
|
||||||
-f DiunaBI.API/Dockerfile \
|
|
||||||
-t code.bim-it.pl/mz/diunabi-api:latest \
|
|
||||||
-t code.bim-it.pl/mz/diunabi-api:build-${{ github.run_id }} \
|
|
||||||
--push \
|
|
||||||
.
|
|
||||||
|
|
||||||
- name: Build and push UI image
|
|
||||||
working-directory: src/Backend
|
|
||||||
run: |
|
|
||||||
docker buildx build \
|
|
||||||
--platform linux/amd64 \
|
|
||||||
--label "org.opencontainers.image.source=https://code.bim-it.pl/mz/DiunaBI" \
|
|
||||||
-f DiunaBI.UI.Web/Dockerfile \
|
|
||||||
-t code.bim-it.pl/mz/diunabi-ui:latest \
|
|
||||||
-t code.bim-it.pl/mz/diunabi-ui:build-${{ github.run_id }} \
|
|
||||||
--push \
|
|
||||||
.
|
|
||||||
|
|
||||||
- name: Output build info
|
|
||||||
run: |
|
|
||||||
echo "## 🐳 Docker Images Built" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "**Build ID:** ${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "### Images pushed:" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo '```bash' >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "# Latest (for release)" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "docker pull code.bim-it.pl/mz/diunabi-api:latest" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "docker pull code.bim-it.pl/mz/diunabi-ui:latest" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "# Specific build (for rollback)" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "docker pull code.bim-it.pl/mz/diunabi-api:build-${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "docker pull code.bim-it.pl/mz/diunabi-ui:build-${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
name: ReleaseApp (JS finder + download)
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch: {}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
GITEA_BASE_URL: https://code.bim-it.pl
|
|
||||||
OWNER: mz
|
|
||||||
REPO: DiunaBI
|
|
||||||
REQUIRED_ARTIFACTS: frontend,webapi
|
|
||||||
SCAN_LIMIT: "100"
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: https://github.com/actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Use Node.js 20
|
|
||||||
uses: https://github.com/actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
|
|
||||||
- name: Install unzip (for extraction)
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y unzip
|
|
||||||
|
|
||||||
- name: Resolve latest run that exposes required artifacts
|
|
||||||
id: resolve
|
|
||||||
env:
|
|
||||||
GITEA_PAT: ${{ secrets.GITEATOKEN }}
|
|
||||||
run: |
|
|
||||||
node .gitea/scripts/getLatestRunWithArtifacts.js
|
|
||||||
echo "Resolved run_id: $(cat .gitea/.cache/run_id)"
|
|
||||||
echo "run_id=$(cat .gitea/.cache/run_id)" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Download frontend artifact
|
|
||||||
env:
|
|
||||||
GITEA_PAT: ${{ secrets.GITEATOKEN }}
|
|
||||||
ARTIFACT_NAME: frontend
|
|
||||||
RUN_ID: ${{ steps.resolve.outputs.run_id }}
|
|
||||||
OUTPUT_DIR: artifacts/frontend
|
|
||||||
run: |
|
|
||||||
node .gitea/scripts/downloadArtifactByName.js
|
|
||||||
|
|
||||||
- name: Download webapi artifact
|
|
||||||
env:
|
|
||||||
GITEA_PAT: ${{ secrets.GITEATOKEN }}
|
|
||||||
ARTIFACT_NAME: webapi
|
|
||||||
RUN_ID: ${{ steps.resolve.outputs.run_id }}
|
|
||||||
OUTPUT_DIR: artifacts/webapi
|
|
||||||
run: |
|
|
||||||
node .gitea/scripts/downloadArtifactByName.js
|
|
||||||
|
|
||||||
- name: Show artifact structure
|
|
||||||
run: |
|
|
||||||
echo "::group::frontend"
|
|
||||||
ls -laR artifacts/frontend || true
|
|
||||||
echo "::endgroup::"
|
|
||||||
echo "::group::webapi"
|
|
||||||
ls -laR artifacts/webapi || true
|
|
||||||
echo "::endgroup::"
|
|
||||||
|
|
||||||
- name: Tokenize (replace #{...}# from secrets/vars)
|
|
||||||
env:
|
|
||||||
SECRETS: ${{ toJson(secrets) }}
|
|
||||||
VARIABLES: ${{ toJson(vars) }}
|
|
||||||
RUN_ID: ${{ steps.resolve.outputs.run_id }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
node .gitea/scripts/replaceTokens.js
|
|
||||||
|
|
||||||
- name: Package artifacts as ZIPs
|
|
||||||
run: |
|
|
||||||
mkdir -p build
|
|
||||||
(cd artifacts/frontend && zip -rq ../../build/DiunaBI-Morska-Frontend.zip .)
|
|
||||||
(cd artifacts/webapi && zip -rq ../../build/DiunaBI-Morska-WebApi.zip .)
|
|
||||||
ls -la build
|
|
||||||
|
|
||||||
- name: Upload artifacts to remote server
|
|
||||||
env:
|
|
||||||
SSH_PRIVATE_KEY: ${{ secrets.GITEARUNNER_SSH_KEY }}
|
|
||||||
SSH_USER: mz
|
|
||||||
SSH_HOST: bim-it.pl
|
|
||||||
REMOTE_DIR: deployment
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
umask 077
|
|
||||||
echo "$SSH_PRIVATE_KEY" > private_key
|
|
||||||
chmod 600 private_key
|
|
||||||
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts
|
|
||||||
|
|
||||||
ssh -i private_key "$SSH_USER@$SSH_HOST" "mkdir -p ~/$REMOTE_DIR"
|
|
||||||
|
|
||||||
scp -i private_key build/DiunaBI-Morska-Frontend.zip "$SSH_USER@$SSH_HOST:~/$REMOTE_DIR/"
|
|
||||||
scp -i private_key build/DiunaBI-Morska-WebApi.zip "$SSH_USER@$SSH_HOST:~/$REMOTE_DIR/"
|
|
||||||
|
|
||||||
shred -u private_key
|
|
||||||
|
|
||||||
- name: Run release script on remote server
|
|
||||||
env:
|
|
||||||
SSH_PRIVATE_KEY: ${{ secrets.GITEARUNNER_SSH_KEY }}
|
|
||||||
SSH_USER: mz
|
|
||||||
SSH_HOST: bim-it.pl
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
umask 077
|
|
||||||
echo "$SSH_PRIVATE_KEY" > private_key
|
|
||||||
chmod 600 private_key
|
|
||||||
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts
|
|
||||||
|
|
||||||
ssh -i private_key "$SSH_USER@$SSH_HOST" "./deployment/DiunaBI-Morska.Release.sh"
|
|
||||||
|
|
||||||
shred -u private_key
|
|
||||||
9
DevTools/RESTRequests/test.rest
Normal file
9
DevTools/RESTRequests/test.rest
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
PUT https://pedrollopl.diunabi.com/api/DataInbox/Add/8kL2mN4pQ6rojshf8704i34p4eim1hs
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Basic cGVkcm9sbG9wbDo0MjU4dlc2eFk4TjRwUQ==
|
||||||
|
|
||||||
|
{
|
||||||
|
"Source": "morska.import",
|
||||||
|
"Name": "morska.d3.importer",
|
||||||
|
"Data": "eyJrZXkiOiAidmFsdWUifQ=="
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ DECLARE @JustForDebug TINYINT = 0;
|
|||||||
|
|
||||||
-- SETUP VARIABLES
|
-- SETUP VARIABLES
|
||||||
DECLARE @Type NVARCHAR(3) = 'D3';
|
DECLARE @Type NVARCHAR(3) = 'D3';
|
||||||
DECLARE @Month INT = 11;
|
DECLARE @Month INT = 12;
|
||||||
DECLARE @Year INT = 2025;
|
DECLARE @Year INT = 2025;
|
||||||
|
|
||||||
IF @Type NOT IN ('D3')
|
IF @Type NOT IN ('D3')
|
||||||
@@ -14,7 +14,7 @@ END;
|
|||||||
DECLARE @ImportType NVARCHAR(20) = 'Import-D3';
|
DECLARE @ImportType NVARCHAR(20) = 'Import-D3';
|
||||||
|
|
||||||
DECLARE @StartDate NVARCHAR(10) = FORMAT(DATEADD(DAY, 24, DATEADD(MONTH, @Month - 2, DATEFROMPARTS(YEAR(GETDATE()), 1, 1))), 'yyyy.MM.dd');
|
DECLARE @StartDate NVARCHAR(10) = FORMAT(DATEADD(DAY, 24, DATEADD(MONTH, @Month - 2, DATEFROMPARTS(YEAR(GETDATE()), 1, 1))), 'yyyy.MM.dd');
|
||||||
DECLARE @EndDate NVARCHAR(10) = FORMAT(DATEFROMPARTS(YEAR(GETDATE()), @Month + 1, 5), 'yyyy.MM.dd');
|
DECLARE @EndDate NVARCHAR(10) = FORMAT(DATEFROMPARTS(CASE WHEN @Month = 12 THEN @Year + 1 ELSE @Year END, CASE WHEN @Month = 12 THEN 1 ELSE @Month + 1 END, 5), 'yyyy.MM.dd');
|
||||||
DECLARE @Number INT = (SELECT COUNT(id) + 1 FROM [diunabi-morska].[dbo].[Layers]);
|
DECLARE @Number INT = (SELECT COUNT(id) + 1 FROM [diunabi-morska].[dbo].[Layers]);
|
||||||
DECLARE @CurrentTimestamp NVARCHAR(14) = FORMAT(GETDATE(), 'yyyyMMddHHmm');
|
DECLARE @CurrentTimestamp NVARCHAR(14) = FORMAT(GETDATE(), 'yyyyMMddHHmm');
|
||||||
DECLARE @FormattedMonth NVARCHAR(2) = FORMAT(@Month, '00');
|
DECLARE @FormattedMonth NVARCHAR(2) = FORMAT(@Month, '00');
|
||||||
@@ -2,9 +2,9 @@ DECLARE @JustForDebug TINYINT = 0;
|
|||||||
|
|
||||||
-- SETUP VARIABLES
|
-- SETUP VARIABLES
|
||||||
DECLARE @Type NVARCHAR(3) = 'D1';
|
DECLARE @Type NVARCHAR(3) = 'D1';
|
||||||
DECLARE @Month INT = 11;
|
DECLARE @Month INT = 12;
|
||||||
DECLARE @Year INT = 2025;
|
DECLARE @Year INT = 2025;
|
||||||
DECLARE @MonthName NVARCHAR(20) = 'Pazdziernik_2025';
|
DECLARE @MonthName NVARCHAR(20) = 'Grudzien_2025';
|
||||||
|
|
||||||
IF @Type NOT IN ('K5', 'PU', 'AK', 'FK', 'D1', 'FK2')
|
IF @Type NOT IN ('K5', 'PU', 'AK', 'FK', 'D1', 'FK2')
|
||||||
BEGIN
|
BEGIN
|
||||||
@@ -27,7 +27,7 @@ SET @ImportType =
|
|||||||
ELSE 'Standard'
|
ELSE 'Standard'
|
||||||
END;
|
END;
|
||||||
DECLARE @StartDate NVARCHAR(10) = FORMAT(DATEADD(DAY, 24, DATEADD(MONTH, @Month - 2, DATEFROMPARTS(YEAR(GETDATE()), 1, 1))), 'yyyy.MM.dd');
|
DECLARE @StartDate NVARCHAR(10) = FORMAT(DATEADD(DAY, 24, DATEADD(MONTH, @Month - 2, DATEFROMPARTS(YEAR(GETDATE()), 1, 1))), 'yyyy.MM.dd');
|
||||||
DECLARE @EndDate NVARCHAR(10) = FORMAT(DATEFROMPARTS(YEAR(GETDATE()), @Month + 1, 5), 'yyyy.MM.dd');
|
DECLARE @EndDate NVARCHAR(10) = FORMAT(DATEFROMPARTS(CASE WHEN @Month = 12 THEN @Year + 1 ELSE @Year END, CASE WHEN @Month = 12 THEN 1 ELSE @Month + 1 END, 5), 'yyyy.MM.dd');
|
||||||
DECLARE @Number INT = (SELECT COUNT(id) + 1 FROM [diunabi-morska].[dbo].[Layers]);
|
DECLARE @Number INT = (SELECT COUNT(id) + 1 FROM [diunabi-morska].[dbo].[Layers]);
|
||||||
DECLARE @CurrentTimestamp NVARCHAR(14) = FORMAT(GETDATE(), 'yyyyMMddHHmm');
|
DECLARE @CurrentTimestamp NVARCHAR(14) = FORMAT(GETDATE(), 'yyyyMMddHHmm');
|
||||||
DECLARE @FormattedMonth NVARCHAR(2) = FORMAT(@Month, '00');
|
DECLARE @FormattedMonth NVARCHAR(2) = FORMAT(@Month, '00');
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
DECLARE @JustForDebug TINYINT = 0;
|
DECLARE @JustForDebug TINYINT = 0;
|
||||||
|
|
||||||
-- SETUP VARIABLES
|
-- SETUP VARIABLES
|
||||||
DECLARE @Month INT = 11;
|
DECLARE @Month INT = 12;
|
||||||
DECLARE @Year INT = 2025;
|
DECLARE @Year INT = 2025;
|
||||||
|
|
||||||
DECLARE @Number INT = (SELECT COUNT(id) + 1 FROM [diunabi-morska].[dbo].[Layers]);
|
DECLARE @Number INT = (SELECT COUNT(id) + 1 FROM [diunabi-morska].[dbo].[Layers]);
|
||||||
@@ -4,7 +4,7 @@ DECLARE @JustForDebug TINYINT = 0;
|
|||||||
|
|
||||||
-- SETUP VARIABLES
|
-- SETUP VARIABLES
|
||||||
DECLARE @Type NVARCHAR(3) = 'FK';
|
DECLARE @Type NVARCHAR(3) = 'FK';
|
||||||
DECLARE @Month INT = 11;
|
DECLARE @Month INT = 12;
|
||||||
DECLARE @Year INT = 2025;
|
DECLARE @Year INT = 2025;
|
||||||
|
|
||||||
IF @Type NOT IN ('K5', 'PU', 'AK', 'FK')
|
IF @Type NOT IN ('K5', 'PU', 'AK', 'FK')
|
||||||
@@ -4,7 +4,7 @@ DECLARE @JustForDebug TINYINT = 0;
|
|||||||
|
|
||||||
-- SETUP VARIABLES
|
-- SETUP VARIABLES
|
||||||
DECLARE @Type NVARCHAR(3) = 'FK2';
|
DECLARE @Type NVARCHAR(3) = 'FK2';
|
||||||
DECLARE @Month INT = 11;
|
DECLARE @Month INT = 12;
|
||||||
DECLARE @Year INT = 2025;
|
DECLARE @Year INT = 2025;
|
||||||
|
|
||||||
DECLARE @Number INT = (SELECT COUNT(id) + 1 FROM [diunabi-morska].[dbo].[Layers]);
|
DECLARE @Number INT = (SELECT COUNT(id) + 1 FROM [diunabi-morska].[dbo].[Layers]);
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
DECLARE @JustForDebug TINYINT = 0;
|
DECLARE @JustForDebug TINYINT = 0;
|
||||||
|
|
||||||
-- SETUP VARIABLES
|
-- SETUP VARIABLES
|
||||||
DECLARE @Month INT = 11;
|
DECLARE @Month INT = 12;
|
||||||
DECLARE @Year INT = 2025;
|
DECLARE @Year INT = 2025;
|
||||||
|
|
||||||
DECLARE @Number INT = (SELECT COUNT(id) + 1 FROM [diunabi-morska].[dbo].[Layers]);
|
DECLARE @Number INT = (SELECT COUNT(id) + 1 FROM [diunabi-morska].[dbo].[Layers]);
|
||||||
@@ -4,6 +4,8 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using DiunaBI.Infrastructure.Data;
|
using DiunaBI.Infrastructure.Data;
|
||||||
using DiunaBI.Domain.Entities;
|
using DiunaBI.Domain.Entities;
|
||||||
|
using DiunaBI.Application.DTOModels;
|
||||||
|
using DiunaBI.Application.DTOModels.Common;
|
||||||
|
|
||||||
namespace DiunaBI.API.Controllers;
|
namespace DiunaBI.API.Controllers;
|
||||||
|
|
||||||
@@ -89,17 +91,86 @@ public class DataInboxController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult GetAll()
|
[Route("GetAll")]
|
||||||
|
public IActionResult GetAll([FromQuery] int start, [FromQuery] int limit, [FromQuery] string? search)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var dataInbox = _db.DataInbox.AsNoTracking().ToList();
|
var query = _db.DataInbox.AsQueryable();
|
||||||
_logger.LogDebug("DataInbox: Retrieved {Count} records", dataInbox.Count);
|
|
||||||
return Ok(dataInbox);
|
if (!string.IsNullOrEmpty(search))
|
||||||
|
{
|
||||||
|
query = query.Where(x => x.Name.Contains(search) || x.Source.Contains(search));
|
||||||
|
}
|
||||||
|
|
||||||
|
var totalCount = query.Count();
|
||||||
|
|
||||||
|
var items = query
|
||||||
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
|
.Skip(start)
|
||||||
|
.Take(limit)
|
||||||
|
.AsNoTracking()
|
||||||
|
.Select(x => new DataInboxDto
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
Name = x.Name,
|
||||||
|
Source = x.Source,
|
||||||
|
Data = x.Data,
|
||||||
|
CreatedAt = x.CreatedAt
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var pagedResult = new PagedResult<DataInboxDto>
|
||||||
|
{
|
||||||
|
Items = items,
|
||||||
|
TotalCount = totalCount,
|
||||||
|
Page = (start / limit) + 1,
|
||||||
|
PageSize = limit
|
||||||
|
};
|
||||||
|
|
||||||
|
_logger.LogDebug("GetAll: Retrieved {Count} of {TotalCount} data inbox items (page {Page}) with filter search={Search}",
|
||||||
|
items.Count, totalCount, pagedResult.Page, search);
|
||||||
|
|
||||||
|
return Ok(pagedResult);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.LogError(e, "DataInbox: Error retrieving records");
|
_logger.LogError(e, "GetAll: Error retrieving data inbox items");
|
||||||
|
return BadRequest(e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("{id:guid}")]
|
||||||
|
public IActionResult Get(Guid id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dataInbox = _db.DataInbox
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefault(x => x.Id == id);
|
||||||
|
|
||||||
|
if (dataInbox == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Get: Data inbox item {Id} not found", id);
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
var dto = new DataInboxDto
|
||||||
|
{
|
||||||
|
Id = dataInbox.Id,
|
||||||
|
Name = dataInbox.Name,
|
||||||
|
Source = dataInbox.Source,
|
||||||
|
Data = dataInbox.Data,
|
||||||
|
CreatedAt = dataInbox.CreatedAt
|
||||||
|
};
|
||||||
|
|
||||||
|
_logger.LogDebug("Get: Retrieved data inbox item {Id} {Name}", id, dataInbox.Name);
|
||||||
|
return Ok(dto);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_logger.LogError(e, "Get: Error retrieving data inbox item {Id}", id);
|
||||||
return BadRequest(e.ToString());
|
return BadRequest(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
# Stage 1: Build
|
# Stage 1: Build
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||||
WORKDIR /src/Backend
|
WORKDIR /
|
||||||
|
|
||||||
# Copy solution and all project files for restore
|
# Copy solution and all project files for restore
|
||||||
COPY DiunaBI.sln ./
|
COPY DiunaBI.sln ./
|
||||||
@@ -18,16 +18,16 @@ RUN dotnet restore DiunaBI.API/DiunaBI.API.csproj
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build plugin first
|
# Build plugin first
|
||||||
WORKDIR /src/Backend/DiunaBI.Plugins.Morska
|
WORKDIR /DiunaBI.Plugins.Morska
|
||||||
RUN dotnet build -c Release
|
RUN dotnet build -c Release
|
||||||
|
|
||||||
# Build and publish API
|
# Build and publish API
|
||||||
WORKDIR /src/Backend/DiunaBI.API
|
WORKDIR /DiunaBI.API
|
||||||
RUN dotnet publish -c Release -o /app/publish --no-restore
|
RUN dotnet publish -c Release -o /app/publish --no-restore
|
||||||
|
|
||||||
# Copy plugin DLL to publish output
|
# Copy plugin DLL to publish output
|
||||||
RUN mkdir -p /app/publish/Plugins && \
|
RUN mkdir -p /app/publish/Plugins && \
|
||||||
cp /src/Backend/DiunaBI.Plugins.Morska/bin/Release/net10.0/DiunaBI.Plugins.Morska.dll /app/publish/Plugins/
|
cp /DiunaBI.Plugins.Morska/bin/Release/net10.0/DiunaBI.Plugins.Morska.dll /app/publish/Plugins/
|
||||||
|
|
||||||
# Stage 2: Runtime
|
# Stage 2: Runtime
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
|
||||||
17
DiunaBI.Application/DTOModels/DataInboxDto.cs
Normal file
17
DiunaBI.Application/DTOModels/DataInboxDto.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
namespace DiunaBI.Application.DTOModels;
|
||||||
|
|
||||||
|
public class DataInboxDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
public string Source { get; set; } = string.Empty;
|
||||||
|
public string Data { get; set; } = string.Empty;
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DataInboxFilterRequest
|
||||||
|
{
|
||||||
|
public string? Search { get; set; }
|
||||||
|
public int Page { get; set; } = 1;
|
||||||
|
public int PageSize { get; set; } = 50;
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user