Skip to content
Draft
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": 1,
"isRoot": true,
"tools": {
"minver-cli": {
"version": "2.2.0",
"commands": [
"minver"
]
},
"dotnet-retire": {
"version": "4.0.1",
"commands": [
"dotnet-retire"
]
},
"gpr": {
"version": "0.1.122",
"commands": [
"gpr"
]
}
}
}
51 changes: 51 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ env:
on: [push]

jobs:
vulnerability-scan:
runs-on: ubuntu-latest
name: ci/github/scan-vulnerabilities
container: mcr.microsoft.com/dotnet/core/sdk:3.1-bionic
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Scan for Vulnerabilities
run: |
dotnet tool restore
dotnet restore
dotnet tool run dotnet-retire
build:
runs-on: ubuntu-latest
steps:
Expand All @@ -25,4 +37,43 @@ jobs:
with:
name: functions
path: ${{ env.OUTPUT_PATH }}
publish:
needs: [vulnerability-scan, build]
runs-on: ubuntu-latest
name: ci/github/publish
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get Version
id: get_version
run: |
echo "::set-output name=branch::${GITHUB_REF:10}"

dotnet tool restore
version=$(dotnet tool run minver -- --tag-prefix=v)
echo "::set-output name=version::${version}"
- shell: bash
run: |
git fetch --prune --unshallow
- name: Setup Dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Dotnet Pack
shell: bash
run: |
dotnet pack /p:Version=${{ steps.get_version.outputs.version }} --configuration=Release --output=./packages \

- name: Publish Artifacts
uses: actions/upload-artifact@v1
with:
path: packages
name: nuget-packages
- name: Dotnet Push to Nuget.org
shell: bash
if: contains(steps.get_version.outputs.branch, 'v')
run: |
dotnet tool restore
find . -name "*.nupkg" | xargs -n1 dotnet nuget push --api-key=${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json


1 change: 1 addition & 0 deletions .idea/.idea.SandboxFunctions/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions .idea/.idea.SandboxFunctions/.idea/contentModel.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.SandboxFunctions/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.SandboxFunctions/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.SandboxFunctions/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.SandboxFunctions/.idea/projectSettingsUpdater.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/.idea.SandboxFunctions/.idea/riderModule.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.SandboxFunctions/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

112 changes: 112 additions & 0 deletions .idea/.idea.SandboxFunctions/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions AcceptanceTests/AcceptanceTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.23" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="Moq" Version="4.15.2" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.1" />
<PackageReference Include="coverlet.collector" Version="1.3.0" />
<PackageReference Include="RestSharp" Version="106.11.7" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AzureFunctions.AcceptanceTest.Runner\AzureFunctions.AcceptanceTest.Runner.csproj" />
<ProjectReference Include="..\CustomerFunctions\CustomerFunctions.csproj" />
</ItemGroup>

<ItemGroup>
<Content Include="appsettings.Debug.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Remove="appsettings.json" />
<Content Include="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
27 changes: 27 additions & 0 deletions AcceptanceTests/CustomerAcceptanceTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.Extensions.Primitives;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using AzureFunctions.AcceptanceTest.Runner;
using CustomerFunctions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;

namespace AcceptanceTests
{
[TestClass]
public class CustomerAcceptanceTests : BaseFunctionAcceptanceTests
{
[TestMethod]
public async Task WhenCallCustomerGet_ShouldReturn201()
{
var query = new Dictionary<string, StringValues>();
var body = "{\"name\":\"yamada\"}";
var req = HttpRequestSetup(query, body, "get");
var result = await AzureFunctionInvoker.Invoke((request) => CustomerFunction.Run(request, logger), req);
var resultObject = (OkObjectResult) result;
Assert.AreEqual("Hello, yamada. This HTTP triggered function executed successfully.", resultObject.Value);
}
}
}
10 changes: 10 additions & 0 deletions AcceptanceTests/appsettings.Debug.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
},
"environment": "debug"
}
Loading