Skip to content

Commit ff5d89b

Browse files
authored
Initial commit
0 parents  commit ff5d89b

File tree

251 files changed

+28681
-0
lines changed

Some content is hidden

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

251 files changed

+28681
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
3+
{
4+
"name": "Azure Search OpenAI Js",
5+
6+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
7+
"image": "mcr.microsoft.com/devcontainers/javascript-node:22-bookworm",
8+
9+
// Features to add to the dev container. More info: https://containers.dev/features.
10+
"features": {
11+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
12+
"moby": "false"
13+
},
14+
"ghcr.io/devcontainers/features/powershell:1": {},
15+
"ghcr.io/devcontainers/features/azure-cli:1": {
16+
"version": "latest",
17+
"installBicep": true
18+
},
19+
"ghcr.io/azure/azure-dev/azd:latest": {},
20+
"ghcr.io/grafana/devcontainer-features/k6:1": {}
21+
},
22+
23+
// Configure tool-specific properties.
24+
"customizations": {
25+
"vscode": {
26+
"extensions": [
27+
"ms-azuretools.azure-dev",
28+
"ms-azuretools.vscode-bicep",
29+
"ms-azuretools.vscode-docker",
30+
"esbenp.prettier-vscode",
31+
"humao.rest-client",
32+
"GitHub.copilot",
33+
"runem.lit-plugin",
34+
"ms-playwright.playwright"
35+
]
36+
}
37+
},
38+
39+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
40+
"forwardPorts": [3000, 3001, 5173],
41+
42+
// Use 'postCreateCommand' to run commands after the container is created.
43+
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
44+
45+
// Set minimal host requirements for the container.
46+
"hostRequirements": {
47+
"memory": "8gb"
48+
}
49+
50+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
51+
// "remoteUser": "root"
52+
}

.devcontainer/postCreateCommand.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
echo "Installing dependencies..."
4+
npm install
5+
6+
echo "Installing playwright browsers..."
7+
npx playwright install --with-deps

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules/
2+
dist/
3+
.azure
4+
.env*
5+
static/
6+
dist/
7+
/test-results/
8+
/playwright-report/
9+
/playwright/.cache/
10+
coverage/

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.sh text eol=lf

.github/CODE_OF_CONDUCT.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Microsoft Open Source Code of Conduct
2+
3+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4+
5+
Resources:
6+
7+
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8+
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9+
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns

.github/ISSUE_TEMPLATE.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!--
2+
IF SUFFICIENT INFORMATION IS NOT PROVIDED VIA THE FOLLOWING TEMPLATE THE ISSUE MIGHT BE CLOSED WITHOUT FURTHER CONSIDERATION OR INVESTIGATION
3+
-->
4+
5+
> ## Please provide us with the following information:
6+
7+
### This issue is for a: (mark with an `x`)
8+
9+
```
10+
- [ ] bug report -> please search issues before submitting
11+
- [ ] feature request
12+
- [ ] documentation issue or request
13+
- [ ] regression (a behavior that used to work and stopped in a new release)
14+
```
15+
16+
### Minimal steps to reproduce
17+
18+
>
19+
20+
### Any log messages given by the failure
21+
22+
>
23+
24+
### Expected/desired behavior
25+
26+
>
27+
28+
### OS and Version?
29+
30+
> Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
31+
32+
### azd version?
33+
34+
> run `azd version` and copy paste here.
35+
36+
### Versions
37+
38+
>
39+
40+
### Mention any other details that might be useful
41+
42+
> ---
43+
>
44+
> Thanks! We'll be in touch soon.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## Purpose
2+
3+
<!-- Describe the intention of the changes being proposed. What problem does it solve or functionality does it add? -->
4+
5+
- ...
6+
7+
## Does this introduce a breaking change?
8+
9+
<!-- Mark one with an "x". -->
10+
11+
```
12+
[ ] Yes
13+
[ ] No
14+
```
15+
16+
## Pull Request Type
17+
18+
What kind of change does this Pull Request introduce?
19+
20+
<!-- Please check the one that applies to this PR using "x". -->
21+
22+
```
23+
[ ] Bugfix
24+
[ ] Feature
25+
[ ] Code style update (formatting, local variables)
26+
[ ] Refactoring (no functional changes, no api changes)
27+
[ ] Documentation content changes
28+
[ ] Other... Please describe:
29+
```
30+
31+
## How to Test
32+
33+
- Get the code
34+
35+
```
36+
git clone [repo-address]
37+
cd [repo-name]
38+
git checkout [branch-name]
39+
npm install
40+
```
41+
42+
- Test the code
43+
<!-- Add steps to run the tests suite and/or manually test -->
44+
45+
```
46+
47+
```
48+
49+
## What to Check
50+
51+
Verify that the following are valid
52+
53+
- ...
54+
55+
## Other Information
56+
57+
<!-- Add any other helpful information that may be needed here. -->
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Validate AZD template
2+
on:
3+
push:
4+
branches: [main, develop]
5+
paths:
6+
- 'infra/**'
7+
pull_request:
8+
branches: [main, develop]
9+
paths:
10+
- 'infra/**'
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
security-events: write
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Build Bicep for linting
22+
uses: azure/CLI@v2
23+
with:
24+
inlineScript: az config set bicep.use_binary_from_path=false && az bicep build -f infra/main.bicep --stdout
25+
26+
- name: Run Microsoft Security DevOps Analysis
27+
uses: microsoft/security-devops-action@preview
28+
id: msdo
29+
continue-on-error: true
30+
with:
31+
tools: templateanalyzer
32+
33+
- name: Upload alerts to Security tab
34+
if: github.repository_owner == 'Azure-Samples'
35+
uses: github/codeql-action/upload-sarif@v3
36+
with:
37+
sarif_file: ${{ steps.msdo.outputs.sarifFile }}

.github/workflows/azure-dev.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Deploy on Azure
2+
on:
3+
workflow_dispatch:
4+
push:
5+
# Run when commits are pushed to mainline branch (main)
6+
# Set this to the mainline branch you are using
7+
branches:
8+
- main
9+
10+
# GitHub Actions workflow to deploy to Azure using azd
11+
# To configure required secrets for connecting to Azure, simply run `azd pipeline config`
12+
13+
# Set up permissions for deploying with secretless Azure federated credentials
14+
# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication
15+
permissions:
16+
id-token: write
17+
contents: read
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
env:
23+
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
24+
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
25+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
26+
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
27+
# Only needed for Microsoft internal Azure subscriptions
28+
AZURE_ALIAS: ${{ vars.AZURE_ALIAS }}
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Install azd
34+
uses: Azure/setup-azd@v2
35+
36+
- name: Install Nodejs
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 22
40+
41+
- name: Log in with Azure (Federated Credentials)
42+
if: ${{ env.AZURE_CLIENT_ID != '' }}
43+
run: |
44+
azd auth login `
45+
--client-id "$Env:AZURE_CLIENT_ID" `
46+
--federated-credential-provider "github" `
47+
--tenant-id "$Env:AZURE_TENANT_ID"
48+
shell: pwsh
49+
50+
- name: Log in with Azure (Client Credentials)
51+
if: ${{ env.AZURE_CREDENTIALS != '' }}
52+
run: |
53+
$info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable;
54+
Write-Host "::add-mask::$($info.clientSecret)"
55+
56+
azd auth login `
57+
--client-id "$($info.clientId)" `
58+
--client-secret "$($info.clientSecret)" `
59+
--tenant-id "$($info.tenantId)"
60+
shell: pwsh
61+
env:
62+
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
63+
64+
- name: Provision and deploy application
65+
run: azd up --no-prompt
66+
env:
67+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
68+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
69+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
70+
AZURE_ALIAS: ${{ vars.AZURE_ALIAS }}

.github/workflows/build-test.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and test
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- develop
7+
pull_request:
8+
branches:
9+
- main
10+
- develop
11+
12+
jobs:
13+
test:
14+
strategy:
15+
matrix:
16+
platform: [ubuntu-latest, macos-latest, windows-latest]
17+
node-version: ['22']
18+
19+
name: ${{ matrix.platform }} / Node.js v${{ matrix.node-version }}
20+
runs-on: ${{ matrix.platform }}
21+
steps:
22+
# - run: git config --global core.autocrlf false # Preserve line endings
23+
- uses: actions/checkout@v4
24+
- name: Setup Node.js v${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
- name: Install dependencies
29+
run: npm ci
30+
- name: Build packages
31+
run: npm run build
32+
- if: matrix.platform == 'ubuntu-latest'
33+
name: Build Docker images
34+
run: npm run docker:build
35+
- name: Lint packages
36+
run: npm run lint
37+
- name: Test packages
38+
run: npm test
39+
40+
test_all:
41+
if: always()
42+
runs-on: ubuntu-latest
43+
needs: test
44+
steps:
45+
- name: Check build matrix status
46+
if: ${{ needs.test.result != 'success' }}
47+
run: exit 1

0 commit comments

Comments
 (0)