Skip to content
Open
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
93 changes: 93 additions & 0 deletions .github/workflows/ci-optimized.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CI - Optimized

on:
push:
branches: [ main ]
pull_request:

jobs:

backend:
name: Backend (.NET)
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('lab5/sample-ci/backend/**/*.csproj') }}

- name: Restore
run: |
cd lab5/sample-ci/backend/ProductApi
dotnet restore
cd ../ProductApi.Tests
dotnet restore

- name: Build
run: |
cd lab5/sample-ci/backend/ProductApi
dotnet build --no-restore --configuration Release
cd ../ProductApi.Tests
dotnet build --no-restore --configuration Release

- name: Test
run: |
cd lab5/sample-ci/backend/ProductApi.Tests
dotnet test --no-build --configuration Release --logger trx

- name: Publish
run: |
cd lab5/sample-ci/backend/ProductApi
dotnet publish --no-build --configuration Release --output ./publish

- name: Upload backend artifact
uses: actions/upload-artifact@v4
with:
name: backend
path: lab5/sample-ci/backend/ProductApi/publish

frontend:
name: Frontend (Node.js)
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: lab5/sample-ci/frontend/package-lock.json

- name: Install dependencies
run: |
cd lab5/sample-ci/frontend
npm ci

- name: Run tests
run: |
cd lab5/sample-ci/frontend
npm test

- name: Build
run: |
cd lab5/sample-ci/frontend
npm run build

- name: Upload frontend artifact
uses: actions/upload-artifact@v4
with:
name: frontend
path: lab5/sample-ci/frontend/dist
Binary file modified lab5/sample-ci/README.md
Binary file not shown.
4 changes: 4 additions & 0 deletions lab5/sample-ci/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,9 @@ <h1>Product Manager</h1>
</div>

<script src="app.js"></script>
<footer style="text-align: center; margin-top: 20px; padding: 10px; background: #f5f5f5;">
<p>© 2025 WSEI | CI/CD Demo</p>
</footer>

</body>
</html>