Skip to content

Commit

Permalink
Copy static files in proper folder (microsoft#678)
Browse files Browse the repository at this point in the history
### Motivation and Context
We want static files to be properly served by the backend

### Description
- Copy folder contents of "build" instead of folder itself
- Add int test to check for presence of static files

### Contribution Checklist
- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [Contribution
Guidelines](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
  • Loading branch information
glahaye authored Nov 29, 2023
1 parent fd16a8c commit a624d20
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
21 changes: 21 additions & 0 deletions integration-tests/StaticFiles.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft. All rights reserved.

using System.Net.Http;
using Xunit;

namespace ChatCopilotIntegrationTests;

public class StaticFiles : ChatCopilotIntegrationTest
{
[Fact]
public async void GetStaticFiles()
{
HttpResponseMessage response = await this._httpClient.GetAsync("index.html");
response.EnsureSuccessStatusCode();
Assert.True(response.Content.Headers.ContentLength > 1);

response = await this._httpClient.GetAsync("favicon.ico");
response.EnsureSuccessStatusCode();
Assert.True(response.Content.Headers.ContentLength > 1);
}
}
2 changes: 1 addition & 1 deletion scripts/deploy/package-webapi.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ if (-Not $SkipFrontendFiles) {
Pop-Location

Write-Host "Copying frontend files to package"
Copy-Item -Path "$PSScriptRoot/../../webapp/build" -Destination "$publishOutputDirectory\wwwroot" -Recurse -Force
Copy-Item -Path "$PSScriptRoot/../../webapp/build/*" -Destination "$publishOutputDirectory\wwwroot" -Recurse -Force
}

Write-Host "Compressing package to $publishedZipFilePath"
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/package-webapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ if [[ -z "$SKIP_FRONTEND" ]]; then
popd

echo "Copying frontend files to package"
cp -R "$SCRIPT_ROOT/../../webapp/build" "$PUBLISH_OUTPUT_DIRECTORY/wwwroot"
cp -R "$SCRIPT_ROOT/../../webapp/build/." "$PUBLISH_OUTPUT_DIRECTORY/wwwroot"
fi

# if not NO_ZIP then zip the package
Expand Down

0 comments on commit a624d20

Please sign in to comment.