build
This commit is contained in:
78
.github/workflows/build.yml
vendored
78
.github/workflows/build.yml
vendored
@@ -1,12 +1,16 @@
|
|||||||
name: BuildApp
|
name: BuildApp
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
# push:
|
||||||
branches:
|
# branches: [ main ]
|
||||||
- main
|
# pull_request:
|
||||||
pull_request:
|
#branches: [ main ]
|
||||||
branches:
|
workflow_dispatch: {}
|
||||||
- main
|
|
||||||
workflow_dispatch:
|
# (opcjonalnie) ogranicz równoległe runy
|
||||||
|
concurrency:
|
||||||
|
group: build-${{ github.ref }}
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-frontend:
|
build-frontend:
|
||||||
@@ -33,11 +37,14 @@ jobs:
|
|||||||
working-directory: src/Frontend
|
working-directory: src/Frontend
|
||||||
run: ng build --configuration=production
|
run: ng build --configuration=production
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact (frontend)
|
||||||
uses: actions/upload-artifact@v4
|
uses: https://github.com/actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: frontend
|
name: frontend
|
||||||
path: src/Frontend/dist
|
path: |
|
||||||
|
src/Frontend/dist
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
build-backend:
|
build-backend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -56,13 +63,12 @@ jobs:
|
|||||||
- name: Build solution and prepare plugins
|
- name: Build solution and prepare plugins
|
||||||
working-directory: src/Backend
|
working-directory: src/Backend
|
||||||
run: |
|
run: |
|
||||||
|
set -e
|
||||||
dotnet build DiunaBI.sln --configuration Release
|
dotnet build DiunaBI.sln --configuration Release
|
||||||
dotnet build DiunaBI.Plugins.Morska/DiunaBI.Plugins.Morska.csproj --configuration Release
|
dotnet build DiunaBI.Plugins.Morska/DiunaBI.Plugins.Morska.csproj --configuration Release
|
||||||
# Przygotuj katalog dla testów
|
|
||||||
mkdir -p DiunaBI.Tests/bin/Release/net8.0/Plugins
|
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/
|
cp DiunaBI.Plugins.Morska/bin/Release/net8.0/DiunaBI.Plugins.Morska.dll DiunaBI.Tests/bin/Release/net8.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/net8.0/DiunaBI.Core.dll DiunaBI.Tests/bin/Release/net8.0/Plugins/
|
||||||
echo "✅ Plugins copied to test directory:"
|
|
||||||
ls -la DiunaBI.Tests/bin/Release/net8.0/Plugins/
|
ls -la DiunaBI.Tests/bin/Release/net8.0/Plugins/
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
@@ -103,11 +109,51 @@ jobs:
|
|||||||
- name: Clean up sensitive files
|
- name: Clean up sensitive files
|
||||||
working-directory: build/webapi
|
working-directory: build/webapi
|
||||||
run: |
|
run: |
|
||||||
rm -f appsettings.Development.json
|
rm -f appsettings.Development.json || true
|
||||||
rm -f client_secrets.Development.json
|
rm -f client_secrets.Development.json || true
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact (webapi)
|
||||||
uses: actions/upload-artifact@v4
|
uses: https://github.com/actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: webapi
|
name: webapi
|
||||||
path: build/webapi
|
path: build/webapi
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
|
copy-artifacts:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [build-frontend, build-backend]
|
||||||
|
if: success()
|
||||||
|
steps:
|
||||||
|
- name: Download frontend artifacts
|
||||||
|
uses: https://github.com/actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: frontend
|
||||||
|
path: frontend
|
||||||
|
|
||||||
|
- name: Download webapi artifacts
|
||||||
|
uses: https://github.com/actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: webapi
|
||||||
|
path: webapi
|
||||||
|
|
||||||
|
- name: Store artifacts locally on runner
|
||||||
|
run: |
|
||||||
|
BUILD_DIR="/runner-cache/builds/$GITHUB_RUN_ID"
|
||||||
|
mkdir -p "$BUILD_DIR"
|
||||||
|
|
||||||
|
cp -r webapi/ "$BUILD_DIR/"
|
||||||
|
cp -r frontend/ "$BUILD_DIR/"
|
||||||
|
|
||||||
|
# Stwórz symlink na "latest"
|
||||||
|
mkdir -p /runner-cache/builds
|
||||||
|
ln -sfn "$BUILD_DIR" /runner-cache/builds/latest
|
||||||
|
|
||||||
|
# Zapisz metadane
|
||||||
|
echo "BUILD_TIME=$(date -Iseconds)" > "$BUILD_DIR/build-info.txt"
|
||||||
|
echo "COMMIT_SHA=${GITHUB_SHA}" >> "$BUILD_DIR/build-info.txt"
|
||||||
|
echo "BRANCH=${GITHUB_REF_NAME}" >> "$BUILD_DIR/build-info.txt"
|
||||||
|
echo "BUILD_ID=${GITHUB_RUN_ID}" >> "$BUILD_DIR/build-info.txt"
|
||||||
|
|
||||||
|
echo "✅ Build artifacts stored in: $BUILD_DIR"
|
||||||
|
ls -la "$BUILD_DIR/"
|
||||||
Reference in New Issue
Block a user