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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
108 changes: 108 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Basic Build and Test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-and-test:
name: Build, Test and Analyze
runs-on: ubuntu-latest
env:
ASSISTANT_ID: ${{ secrets.ASSISTANT_ID }}

steps:
# 1. Checkout source code
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevance of analysis

# 2. Install required dependencies (Setup environment)
# Uses global.json to pick the correct .NET SDK version
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json

# JDK 17 is required for SonarScanner
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'

# Install the SonarScanner tool globally
- name: Install SonarCloud scanner
run: |
dotnet tool install --global dotnet-sonarscanner

# 3. SonarCloud Begin (Quality Check Setup)
- name: Begin Sonar scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Necesario para comentar en el PR
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet sonarscanner begin /k:"epam-ai_eShop" /o:"epam-ai" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vstest.reportsPaths="**/*.trx" /d:sonar.cs.vscoveragexml.reportsPaths="**/coverage.cobertura.xml"

# 4. Install dependencies (Restore)
- name: Restore dependencies
run: dotnet restore eShop.slnx

# 5. Build the application
- name: Build
run: dotnet build eShop.slnx --no-restore --configuration Debug

# 6. Run automated tests
# Fails pipeline if tests fail. Generates coverage for SonarQube.
- name: Test
run: dotnet test --solution eShop.Web.slnf --no-build --no-progress --output detailed

# 7. Execute SonarCloud Analysis (End)
# This pushes the analysis to the server and performs the quality gate check
- name: End Sonar scan
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

- name: Get Access Token
id: auth
env:
CODEMIE_CLIENT_ID: ${{ secrets.CODEMIE_CLIENT_ID }}
CODEMIE_CLIENT_SECRET: ${{ secrets.CODEMIE_CLIENT_SECRET }}
run: |
set -euo pipefail

ACCESS_TOKEN=$(curl -s -X POST 'https://keycloak.eks-core.aws.main.edp.projects.epam.com/auth/realms/codemie-prod/protocol/openid-connect/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=password' \
-d 'client_id=codemie-sdk' \
-d "username=${CODEMIE_CLIENT_ID}" \
-d "password=${CODEMIE_CLIENT_SECRET}" | jq -r '.access_token')

if [[ -z "${ACCESS_TOKEN}" || "${ACCESS_TOKEN}" == "null" ]]; then
echo "Failed to obtain access token" >&2
exit 1
fi

echo "access_token=${ACCESS_TOKEN}" >> $GITHUB_OUTPUT
echo "Access token obtained successfully"

- name: Call CodeMie Agent
env:
ACCESS_TOKEN: ${{ steps.auth.outputs.access_token }}
run: |
set -euo pipefail

RESPONSE=$(curl -s -X POST "https://codemie.lab.epam.com/code-assistant-api/v1/assistants/${ASSISTANT_ID}/model" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d "{\"text\": \"Hi\"}")
echo "$RESPONSE"
GENERATED=$(echo "$RESPONSE" | jq -r '.generated')

echo "CodeMie Agent Response:"
echo "$GENERATED"
69 changes: 69 additions & 0 deletions .github/workflows/codemieAgent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Call CodeMie Agent

on:
workflow_dispatch:
inputs:
prompt:
description: Prompt to send to CodeMie Agent
required: true
type: string

jobs:
call:
runs-on: ubuntu-latest
env:
ASSISTANT_ID: ${{ secrets.ASSISTANT_ID }}
PROMPT: ${{ inputs.prompt }}
steps:
- name: Get Access Token
id: auth
env:
CODEMIE_CLIENT_ID: ${{ secrets.CODEMIE_CLIENT_ID }}
CODEMIE_CLIENT_SECRET: ${{ secrets.CODEMIE_CLIENT_SECRET }}
run: |
set -euo pipefail

ACCESS_TOKEN=$(curl -s -X POST 'https://keycloak.eks-core.aws.main.edp.projects.epam.com/auth/realms/codemie-prod/protocol/openid-connect/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=password' \
-d 'client_id=codemie-sdk' \
-d "username=${CODEMIE_CLIENT_ID}" \
-d "password=${CODEMIE_CLIENT_SECRET}" | jq -r '.access_token')

if [[ -z "${ACCESS_TOKEN}" || "${ACCESS_TOKEN}" == "null" ]]; then
echo "Failed to obtain access token" >&2
exit 1
fi

echo "access_token=${ACCESS_TOKEN}" >> $GITHUB_OUTPUT
echo "Access token obtained successfully"

- name: Call CodeMie Agent
env:
ACCESS_TOKEN: ${{ steps.auth.outputs.access_token }}
run: |
set -euo pipefail

RESPONSE=$(curl -s -X POST "https://codemie.lab.epam.com/code-assistant-api/v1/assistants/${ASSISTANT_ID}/model" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d "{\"text\": \"${PROMPT}\"}")
echo "$RESPONSE"
GENERATED=$(echo "$RESPONSE" | jq -r '.generated')
RESULT=$(echo "$GENERATED" | grep -oP 'result: \K\w+' | head -1)
DETAIL=$(echo "$GENERATED" | sed -n '/detail:/,$p' | sed '1d')

echo "CodeMie Agent Response:"
echo "$DETAIL"

if [[ "$RESULT" != "true" ]]; then
echo "Pipeline failed: result is false" >&2
exit 1
fi

- name: Validate Workflow
run: |
RANDOM_ID=$(uuidgen)
echo "Workflow validation ID: $RANDOM_ID"

17 changes: 0 additions & 17 deletions .github/workflows/markdownlint-problem-matcher.json

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/markdownlint.yml

This file was deleted.

11 changes: 5 additions & 6 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ jobs:
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install .NET HTTPS Development Certificate
# if: matrix.os == 'ubuntu-latest'
run: |
dotnet dev-certs https --clean
dotnet dev-certs https --trust
run: npm install
- name: Install Playwright Browsers
run: npx playwright install chromium
- name: Run Playwright tests
Expand All @@ -42,6 +37,10 @@ jobs:
ESHOP_USE_HTTP_ENDPOINTS: 1
USERNAME1: bob
PASSWORD: Pass123$
RP_API_KEY: ${{ secrets.REPORTPORTAL_API_KEY }}
RP_ENDPOINT: "https://reportportal.epam.com/api/v1"
RP_PROJECT: ${{ secrets.REPORTPORTAL_PROJECT }}
RP_LAUNCH: "Playwright E2E | ${{ github.repository }} | ${{ github.ref_name }} | #${{ github.run_number }}"
- uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/pr-validation-maui.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/pr-validation.yml

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ A reference .NET application implementing an e-commerce website using a services

## Getting Started

This version of eShop is based on .NET 9.

Previous eShop versions:
* [.NET 8](https://github.com/dotnet/eShop/tree/release/8.0)
This version of eShop is based on [.NET 10](https://dotnet.microsoft.com/en-us/download/dotnet/10.0).
You need to have this version of the SDK installed in your laptop to run the app.

### Prerequisites

Expand Down Expand Up @@ -79,8 +77,10 @@ then look for lines like this in the console output in order to find the URL to
Login to the dashboard at: http://localhost:19888/login?t=uniquelogincodeforyou
```

> You may need to install ASP.NET Core HTTPS development certificates first, and then close all browser tabs. Learn more at https://aka.ms/aspnet/https-trust-dev-cert

> You may need to install ASP.NET Core HTTPS development certificates first, and then close all browser tabs running the below command. Learn more at https://aka.ms/aspnet/https-trust-dev-cert
```sh
dotnet dev-certs https --trust
```
### Azure Open AI

When using Azure OpenAI, inside *eShop.AppHost/appsettings.json*, add the following section:
Expand Down
21 changes: 9 additions & 12 deletions eShop.slnx
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
<Solution>
<Folder Name="/Solution Items/">
<File Path=".editorconfig" />
<File Path="Directory.Packages.props" />
<File Path="NuGet.config" />
<File Path="README.md" />
</Folder>
<Folder Name="/src/">
<Project Path="src/eShop.AppHost/eShop.AppHost.csproj" />
<Project Path="src/Basket.API/Basket.API.csproj" />
<Project Path="src/Catalog.API/Catalog.API.csproj" />
<Project Path="src/eShop.AppHost/eShop.AppHost.csproj" />
<Project Path="src/eShop.ServiceDefaults/eShop.ServiceDefaults.csproj" />
<Project Path="src/EventBus/EventBus.csproj" />
<Project Path="src/EventBusRabbitMQ/EventBusRabbitMQ.csproj" />
<Project Path="src/Identity.API/Identity.API.csproj" />
<Project Path="src/IntegrationEventLogEF/IntegrationEventLogEF.csproj" />
<Project Path="src/Ordering.API/Ordering.API.csproj" />
<Project Path="src/OrderProcessor/OrderProcessor.csproj" />
<Project Path="src/Ordering.Domain/Ordering.Domain.csproj" />
<Project Path="src/Ordering.Infrastructure/Ordering.Infrastructure.csproj" />
<Project Path="src/OrderProcessor/OrderProcessor.csproj" />
<Project Path="src/PaymentProcessor/PaymentProcessor.csproj" />
<Project Path="src/WebApp/WebApp.csproj" />
<Project Path="src/WebAppComponents/WebAppComponents.csproj" />
<Project Path="src/WebhookClient/WebhookClient.csproj" />
<Project Path="src/Webhooks.API/Webhooks.API.csproj" />
<Project Path="src/WebAppComponents/WebAppComponents.csproj" />
<Project Path="src/HybridApp/HybridApp.csproj" />
<Project Path="src/ClientApp/ClientApp.csproj" />
</Folder>
<Folder Name="/tests/">
<Project Path="tests/Basket.UnitTests/Basket.UnitTests.csproj" />
<Project Path="tests/Catalog.FunctionalTests/Catalog.FunctionalTests.csproj" />
<Project Path="tests/Ordering.FunctionalTests/Ordering.FunctionalTests.csproj" />
<Project Path="tests/Ordering.UnitTests/Ordering.UnitTests.csproj" />
<Project Path="tests/ClientApp.UnitTests/ClientApp.UnitTests.csproj" />
</Folder>
<Folder Name="/Solution Items/">
<File Path=".editorconfig" />
<File Path="Directory.Packages.props" />
<File Path="NuGet.config" />
<File Path="README.md" />
</Folder>
</Solution>
Loading