Skip to content

Commit b926544

Browse files
author
Desmond Howard
authored
Refactor webapi directory structure (microsoft#100)
### Motivation and Context <!-- Thank you for your contribution to the copilot-chat repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> as the project has grown, the structure of webapi has become a bit hard to parse through, especially for a new dev coming into the project. this PR aims to reduce that tension and in general, reduce the clutter within the api. > NOTE: the PR will be easier to review by going through each commit separately. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> - moves `deploy` folder into `scripts` folder. - moves `importdocument` folder into `tools` folder. - moves code from `webapi/CopilotChat` up a level and removes duplicate folders. - changes root namespace from `SemanticKernel.Service` to `CopilotChat.WebApi`. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [Contribution Guidelines](https://github.com/microsoft/copilot-chat/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/copilot-chat/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone 😄
1 parent 03359da commit b926544

File tree

128 files changed

+444
-542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+444
-542
lines changed

.github/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212

1313
# Add 'deployment' label to any change within the 'deploy' directory
1414
deployment:
15-
- deploy/**/*
15+
- scripts/deploy/**/*
1616

1717
# Add 'documentation' label to any change of '.md' files
1818
documentation:

.github/workflows/copilot-chat-package.yml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ name: copilot-chat-package
66

77
on:
88
pull_request:
9-
branches: [ "main" ]
9+
branches: ["main"]
1010
merge_group:
11-
branches: [ "main" ]
11+
branches: ["main"]
1212

1313
concurrency:
1414
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -20,36 +20,36 @@ permissions:
2020
jobs:
2121
copilot-chat-package:
2222
strategy:
23-
fail-fast: false
24-
matrix:
25-
include:
26-
- { dotnet: '6.0', configuration: Release, os: ubuntu-latest }
23+
fail-fast: false
24+
matrix:
25+
include:
26+
- { dotnet: "6.0", configuration: Release, os: ubuntu-latest }
2727

2828
runs-on: ${{ matrix.os }}
2929
env:
3030
NUGET_CERT_REVOCATION_MODE: offline
3131
steps:
32-
- uses: actions/checkout@v3
33-
with:
34-
clean: true
35-
36-
- name: Pull container dotnet/sdk:${{ matrix.dotnet }}
37-
run: docker pull mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }}
38-
39-
- name: Package Copilot Chat WebAPI
40-
run: |
41-
chmod +x $(pwd)/deploy/package-webapi.sh;
42-
docker run --rm -v $(pwd):/app -w /app -e GITHUB_ACTIONS='true' mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }} /bin/sh -c "/app/deploy/package-webapi.sh --no-zip";
43-
44-
- name: Set version tag
45-
id: versiontag
46-
run: |
47-
VERSION_TAG="$(date +'%Y%m%d').${{ github.run_number }}.${{ github.run_attempt }}"
48-
echo $VERSION_TAG
49-
echo "versiontag=$VERSION_TAG" >> $GITHUB_OUTPUT
50-
51-
- name: Upload package to artifacts
52-
uses: actions/upload-artifact@v3
53-
with:
54-
name: copilotchat-webapi-${{ steps.versiontag.outputs.versiontag }}
55-
path: ./deploy/publish
32+
- uses: actions/checkout@v3
33+
with:
34+
clean: true
35+
36+
- name: Pull container dotnet/sdk:${{ matrix.dotnet }}
37+
run: docker pull mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }}
38+
39+
- name: Package Copilot Chat WebAPI
40+
run: |
41+
chmod +x $(pwd)/scripts/deploy/package-webapi.sh;
42+
docker run --rm -v $(pwd):/app -w /app -e GITHUB_ACTIONS='true' mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }} /bin/sh -c "/app/scripts/deploy/package-webapi.sh --no-zip";
43+
44+
- name: Set version tag
45+
id: versiontag
46+
run: |
47+
VERSION_TAG="$(date +'%Y%m%d').${{ github.run_number }}.${{ github.run_attempt }}"
48+
echo $VERSION_TAG
49+
echo "versiontag=$VERSION_TAG" >> $GITHUB_OUTPUT
50+
51+
- name: Upload package to artifacts
52+
uses: actions/upload-artifact@v3
53+
with:
54+
name: copilotchat-webapi-${{ steps.versiontag.outputs.versiontag }}
55+
path: ./scripts/deploy/publish

.github/workflows/copilot-deploy-frontend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ jobs:
7171
7272
- name: Deploy SWA
7373
run: |
74-
deploy/deploy-webapp.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{inputs.DEPLOYMENT_NAME}} --application-id ${{vars.APPLICATION_CLIENT_ID}} --authority ${{secrets.APPLICATION_AUTHORITY}} --no-redirect
74+
scripts/deploy/deploy-webapp.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{inputs.DEPLOYMENT_NAME}} --application-id ${{vars.APPLICATION_CLIENT_ID}} --authority ${{secrets.APPLICATION_AUTHORITY}} --no-redirect

.github/workflows/copilot-deploy-infra.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ jobs:
6161
inlineScript: |
6262
AI_SERVICE_KEY=$(az cognitiveservices account keys list --name ${{vars.AZUREOPENAI__NAME}} --resource-group ${{vars.AZUREOPENAI_DEPLOYMENT_GROUP_NAME}} | jq -r '.key1')
6363
echo "::add-mask::$AI_SERVICE_KEY"
64-
deploy/deploy-azure.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --web-api-key ${{secrets.WEB_API_KEY}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{steps.deployment-id.outputs.deployment_name}} --region ${{vars.CC_DEPLOYMENT_REGION}} --ai-service AzureOpenAI --ai-endpoint ${{secrets.AZURE_OPENAI_ENDPOINT}} --ai-service-key $AI_SERVICE_KEY --app-service-sku ${{vars.WEBAPP_API_SKU}} --no-deploy-package --debug-deployment
64+
scripts/deploy/deploy-azure.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --web-api-key ${{secrets.WEB_API_KEY}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{steps.deployment-id.outputs.deployment_name}} --region ${{vars.CC_DEPLOYMENT_REGION}} --ai-service AzureOpenAI --ai-endpoint ${{secrets.AZURE_OPENAI_ENDPOINT}} --ai-service-key $AI_SERVICE_KEY --app-service-sku ${{vars.WEBAPP_API_SKU}} --no-deploy-package --debug-deployment

.vscode/launch.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
5+
{
6+
"name": "Debug CopilotChatWebApi",
7+
"type": "coreclr",
8+
"preLaunchTask": "build (CopilotChatWebApi)",
9+
"request": "launch",
10+
"program": "${workspaceFolder}/webapi/bin/Debug/net6.0/CopilotChatWebApi.dll",
11+
"cwd": "${workspaceFolder}/webapi",
12+
"env": {
13+
"ASPNETCORE_ENVIRONMENT": "Development"
14+
},
15+
}
16+
]
17+
}

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"type": "process",
8484
"args": [
8585
"build",
86-
"${workspaceFolder}/CopilotChatWebApi.csproj",
86+
"${workspaceFolder}/webapi/CopilotChatWebApi.csproj",
8787
"/property:GenerateFullPaths=true",
8888
"/consoleloggerparameters:NoSummary",
8989
"/property:DebugType=portable"

CopilotChat.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.6.33706.43
@@ -22,4 +22,4 @@ Global
2222
GlobalSection(ExtensibilityGlobals) = postSolution
2323
SolutionGuid = {971570D3-60EA-4EE4-980C-0BDA3E66E741}
2424
EndGlobalSection
25-
EndGlobal
25+
EndGlobal
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)