Last active
February 26, 2022 18:31
-
-
Save justinyoo/890cb4f3e409e237cf8405a7a343a04a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run the function app in background | |
func start & | |
# Send request to the function app and save it to swagger.json | |
curl http://localhost:7071/api/swagger.json > swagger.json | |
# Read swagger.json | |
cat swagger.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run the function app in background | |
Start-Process -NoNewWindow func @("start") | |
# Send request to the function app and save it to swagger.json | |
Invoke-RestMethod -Method Get -Uri http://localhost:7071/api/swagger.json | ` | |
ConvertTo-Json -Depth 100 | ` | |
Out-File -FilePath swagger.json -Force | |
# Read swagger.json | |
Get-Content -Path swagger.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change the function app runner from .ps1 to .cmd | |
$func = $(Get-Command func).Source.Replace(".ps1", ".cmd") | |
# Run the function app in background | |
Start-Process -NoNewWindow "$func" @("start") | |
# Send request to the function app and save it to swagger.json | |
Invoke-RestMethod -Method Get -Uri http://localhost:7071/api/swagger.json | ` | |
ConvertTo-Json -Depth 100 | ` | |
Out-File -FilePath swagger.json -Force | |
# Read swagger.json | |
Get-Content -Path swagger.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
jobs: | |
build_and_test: | |
name: Build | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: Build solution | |
shell: pwsh | |
run: | | |
pushd MyFunctionApp | |
dotnet build . -c Release -v minimal | |
popd | |
- name: Generate OpenAPI document | |
shell: pwsh | |
run: | | |
cd MyFunctionApp | |
Start-Process -NoNewWindow func @("start","--verbose","false") | |
Start-Sleep -s 60 | |
Invoke-RestMethod -Method Get -Uri http://localhost:7071/api/swagger.json | ` | |
ConvertTo-Json -Depth 100 | ` | |
Out-File -FilePath swagger.json -Force | |
Get-Content -Path swagger.json -Raw | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment