Skip to content

Commit

Permalink
Migrate to Kiota (#168)
Browse files Browse the repository at this point in the history
* Add microsoft.openapi.kiota

* Call dotnet tool restore

* Add kiota dependencies

* Add GenerateClient task

* Drop H.NSwag.Generator

* Drop Microsoft.Kiota.Authentication.Azure

* Update Microsoft.Kiota

* Add dotnet-tools.json into .sln

* Remove swagger dependencies from Apple.AppStoreConnect

* Update AppDeserializeTests

* Drop not needed classes

* Add kiota build

* Fix actions/checkout

* Use path

* Fix kiota dotnet publish

* Add kiota into local dictionary

* Update Test.Apple.AppStoreConnect.csproj

* Add Suppress CA2000

* Fix Suppress CA2000

* Try to fix Suppress CA2000

* Fix Suppress CA2000

* Export kiota command

* Call restore as separate command

* Add kiota help

* Add KIOTA env into restore

* Fix restore

* Export kiota command

* Fix KiotaExec

* Drop unused transpose generator

* Use build-kiota in all workflows

* Drop unused swagger templates

* Add disable-validation-rules KnownAndNotSupportedFormats

* Rename Apple.AppStoreConnect.Tests

* Update namespace

* Drop net7.0

* Add DependencyInjectionExtensions

* Bump Apple.AppStoreConnect.Playground.csproj

* Use keyed services

* Add options into AddAppleAppStoreConnect

* Drop net7.0

* Configure Apple.AppStoreConnect.Playground

* Drop unused interfaces

* Implement DefaultAccessTokenProvider

* Drop unused projects

* Simplify KiotaServiceCollectionExtensions

* Drop Apple.AppStoreConnect.Generator.props Project Import

* Update dependencies

* Fix code-style

* Drop net7 dotnet

* Fix CS
  • Loading branch information
trejjam committed Aug 27, 2024
1 parent 43c208e commit 40dccdc
Show file tree
Hide file tree
Showing 83 changed files with 509 additions and 4,331 deletions.
13 changes: 13 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"microsoft.openapi.kiota": {
"version": "1.17.0",
"commands": [
"kiota"
],
"rollForward": false
}
}
}
39 changes: 39 additions & 0 deletions .github/actions/build-kiota/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Build Kiota"
description: "Build Kiota"
outputs:
command:
description: "Kiota command"
value: ${{ steps.kiota.outputs.command }}
runs:
using: "composite" # <-- this is the important part
steps:
- uses: actions/checkout@v4
with:
repository: microsoft/kiota
ref: main
path: kiota
- name: Suppress CA2000
run: |
echo '' | tee -a kiota/.editorconfig
echo '[src/kiota/Handlers/*.cs]' | tee -a kiota/.editorconfig
echo 'dotnet_diagnostic.CA2000.severity = none' | tee -a kiota/.editorconfig
shell: bash
- name: Kiota restore
run: dotnet restore --nologo kiota/src/kiota/kiota.csproj -r linux-x64
shell: bash
- name: Kiota publish
run: dotnet publish --no-restore --nologo kiota/src/kiota/kiota.csproj -c Release -p:PublishSingleFile=true -r linux-x64 --output bin
shell: bash
- name: Build
run: |
echo "command=${PWD}/bin/kiota" >> "$GITHUB_OUTPUT"
shell: bash
id: kiota
- name: Kiota binary
run: |
echo "The string is: ${{ steps.kiota.outputs.command }}"
shell: bash
- name: Kiota help
run: |
${{ steps.kiota.outputs.command }} --help
shell: bash
20 changes: 16 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
schedule:
- cron: "0 8 * * 1" # At 08:00 on Monday

env:
KIOTA_TUTORIAL_ENABLED: false

jobs:
unit-test:
runs-on: ubuntu-latest
Expand All @@ -18,11 +21,16 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
7.0.x
8.0.x
- uses: actions/checkout@v4
- name: Retore
- name: Tool restore
run: dotnet tool restore
- uses: ./.github/actions/build-kiota
id: kiota
- name: Restore
run: dotnet restore --nologo
env:
KIOTA_BIN: ${{ steps.kiota.outputs.command }}
- name: Build
run: dotnet build --no-restore --nologo --configuration Release
- name: Test
Expand All @@ -38,7 +46,11 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Retore
- uses: ./.github/actions/build-kiota
id: kiota
- name: Restore
run: dotnet restore --nologo
env:
KIOTA_BIN: ${{ steps.kiota.outputs.command }}
- name: .Net Format
run: dotnet format --no-restore --verify-no-changes -v diag
run: dotnet format --no-restore --verify-no-changes -v diag --exclude Client
12 changes: 10 additions & 2 deletions .github/workflows/nightly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main

env:
KIOTA_TUTORIAL_ENABLED: false

jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -15,7 +18,6 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
7.0.x
8.0.x
- uses: actions/checkout@v4
- name: Fetch all history for all tags and branches
Expand All @@ -31,8 +33,14 @@ jobs:
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.MajorMinorPatch }}"
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
echo "CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.CommitsSinceVersionSourcePadded }}"
- name: Restore with .Net
- name: Tool restore
run: dotnet tool restore
- uses: ./.github/actions/build-kiota
id: kiota
- name: Restore
run: dotnet restore --nologo
env:
KIOTA_BIN: ${{ steps.kiota.outputs.command }}
- name: Build with .Net
run: dotnet build --configuration Release --no-restore --nologo "-p:Version=${{ steps.gitversion.outputs.NuGetVersionV2 }}"
- name: Pack with .Net
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- reopened
merge_group:

env:
KIOTA_TUTORIAL_ENABLED: false

jobs:
unit-test:
runs-on: ubuntu-latest
Expand All @@ -18,11 +21,16 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
7.0.x
8.0.x
- uses: actions/checkout@v4
- name: Retore
- name: Tool restore
run: dotnet tool restore
- uses: ./.github/actions/build-kiota
id: kiota
- name: Restore
run: dotnet restore --nologo
env:
KIOTA_BIN: ${{ steps.kiota.outputs.command }}
- name: Build
run: dotnet build --no-restore --nologo --configuration Release
- name: Test
Expand All @@ -38,7 +46,11 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Retore
- uses: ./.github/actions/build-kiota
id: kiota
- name: Restore
run: dotnet restore --nologo
env:
KIOTA_BIN: ${{ steps.kiota.outputs.command }}
- name: .Net Format
run: dotnet format --no-restore --verify-no-changes -v diag
run: dotnet format --no-restore --verify-no-changes -v diag --exclude Client
12 changes: 10 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
release:
types: [created]

env:
KIOTA_TUTORIAL_ENABLED: false

jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -17,7 +20,6 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
7.0.x
8.0.x
- uses: actions/checkout@v4
- name: Fetch all history for all tags and branches
Expand All @@ -32,8 +34,14 @@ jobs:
- run: |
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
echo "NuGetPreReleaseTagV2 (not used): ${{ steps.gitversion.outputs.CommitsSinceVersionSourcePadded }}"
- name: Restore with .Net
- name: Tool restore
run: dotnet tool restore
- uses: ./.github/actions/build-kiota
id: kiota
- name: Restore
run: dotnet restore --nologo
env:
KIOTA_BIN: ${{ steps.kiota.outputs.command }}
- name: Build with .Net
run: dotnet build --configuration Release --no-restore --nologo "-p:Version=${{ steps.gitversion.outputs.MajorMinorPatch }}"
- name: Pack with .Net
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -366,4 +366,8 @@ ASALocalRun/
**/*.appsettings.json5
/src/Apple.AppStoreConnect.OpenApiDocument/app-store-connect-openapi-specification.zip
/src/Apple.AppStoreConnect.OpenApiDocument/app-store-connect-openapi-specification/
/src/Apple.AppStoreConnect/app-store-connect-openapi-specification.zip
/src/Apple.AppStoreConnect/app-store-connect-openapi-specification/
/src/Apple.AppStoreConnect/Client
/src/Apple.AppStoreConnect/.kiota.log
/src/Apple.AppStoreConnect/kiota-lock.json
45 changes: 10 additions & 35 deletions Apple.AppStoreConnect.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_SolutionFiles", "_Solution
README.md = README.md
src\WarningConfiguration.targets = src\WarningConfiguration.targets
.github\dependabot.yml = .github\dependabot.yml
.config\dotnet-tools.json = .config\dotnet-tools.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{41F367B1-2907-4A57-BCE7-253D144AEC3B}"
Expand All @@ -21,19 +22,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
.github\workflows\release.yml = .github\workflows\release.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apple.AppStoreConnect.OpenApiDocument", "src\Apple.AppStoreConnect.OpenApiDocument\Apple.AppStoreConnect.OpenApiDocument.csproj", "{8B762CC3-5E4F-434A-B234-195A197F80C1}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apple.AppStoreConnect.Tests", "src\Apple.AppStoreConnect.Tests\Apple.AppStoreConnect.Tests.csproj", "{A300C564-B7FB-443A-A4B7-620A40DAD338}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apple.AppStoreConnect.OpenApiDocument.Generator", "src\Apple.AppStoreConnect.OpenApiDocument.Generator\Apple.AppStoreConnect.OpenApiDocument.Generator.csproj", "{AACBF52E-C970-4B1C-8510-7AD957CFF36E}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{6DC80BC8-A821-4B35-B462-EBE28736F838}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apple.AppStoreConnect.DependencyInjection", "src\Apple.AppStoreConnect.DependencyInjection\Apple.AppStoreConnect.DependencyInjection.csproj", "{F6F69E08-219D-4D94-9979-BFED994DF3BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apple.AppStoreConnect.DependencyInjection.Generator", "src\Apple.AppStoreConnect.DependencyInjection.Generator\Apple.AppStoreConnect.DependencyInjection.Generator.csproj", "{28C1B7E9-6C2A-439B-B101-C67C9C0C1923}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.Apple.AppStoreConnect", "src\Test.Apple.AppStoreConnect\Test.Apple.AppStoreConnect.csproj", "{A300C564-B7FB-443A-A4B7-620A40DAD338}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apple.AppStoreConnect.Generator", "src\Apple.AppStoreConnect.Generator\Apple.AppStoreConnect.Generator.csproj", "{E433055E-6D95-45FD-83F5-F8BCE3E432CE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apple.AppStoreConnect.GeneratorCommon", "src\Apple.AppStoreConnect.GeneratorCommon\Apple.AppStoreConnect.GeneratorCommon.csproj", "{1F32BDF4-EF4D-4815-8E75-2223D254B569}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apple.AppStoreConnect.Playground", "src\Apple.AppStoreConnect.Playground\Apple.AppStoreConnect.Playground.csproj", "{684A4BB4-CF2A-45F8-9179-67EBF2848F18}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -45,36 +38,18 @@ Global
{5C1DE36B-D30D-4595-AC7F-C87A91BEBABA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C1DE36B-D30D-4595-AC7F-C87A91BEBABA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C1DE36B-D30D-4595-AC7F-C87A91BEBABA}.Release|Any CPU.Build.0 = Release|Any CPU
{8B762CC3-5E4F-434A-B234-195A197F80C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B762CC3-5E4F-434A-B234-195A197F80C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B762CC3-5E4F-434A-B234-195A197F80C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B762CC3-5E4F-434A-B234-195A197F80C1}.Release|Any CPU.Build.0 = Release|Any CPU
{AACBF52E-C970-4B1C-8510-7AD957CFF36E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AACBF52E-C970-4B1C-8510-7AD957CFF36E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AACBF52E-C970-4B1C-8510-7AD957CFF36E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AACBF52E-C970-4B1C-8510-7AD957CFF36E}.Release|Any CPU.Build.0 = Release|Any CPU
{F6F69E08-219D-4D94-9979-BFED994DF3BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F6F69E08-219D-4D94-9979-BFED994DF3BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6F69E08-219D-4D94-9979-BFED994DF3BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6F69E08-219D-4D94-9979-BFED994DF3BA}.Release|Any CPU.Build.0 = Release|Any CPU
{28C1B7E9-6C2A-439B-B101-C67C9C0C1923}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28C1B7E9-6C2A-439B-B101-C67C9C0C1923}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28C1B7E9-6C2A-439B-B101-C67C9C0C1923}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28C1B7E9-6C2A-439B-B101-C67C9C0C1923}.Release|Any CPU.Build.0 = Release|Any CPU
{A300C564-B7FB-443A-A4B7-620A40DAD338}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A300C564-B7FB-443A-A4B7-620A40DAD338}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A300C564-B7FB-443A-A4B7-620A40DAD338}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A300C564-B7FB-443A-A4B7-620A40DAD338}.Release|Any CPU.Build.0 = Release|Any CPU
{E433055E-6D95-45FD-83F5-F8BCE3E432CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E433055E-6D95-45FD-83F5-F8BCE3E432CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E433055E-6D95-45FD-83F5-F8BCE3E432CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E433055E-6D95-45FD-83F5-F8BCE3E432CE}.Release|Any CPU.Build.0 = Release|Any CPU
{1F32BDF4-EF4D-4815-8E75-2223D254B569}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F32BDF4-EF4D-4815-8E75-2223D254B569}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F32BDF4-EF4D-4815-8E75-2223D254B569}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F32BDF4-EF4D-4815-8E75-2223D254B569}.Release|Any CPU.Build.0 = Release|Any CPU
{684A4BB4-CF2A-45F8-9179-67EBF2848F18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{684A4BB4-CF2A-45F8-9179-67EBF2848F18}.Debug|Any CPU.Build.0 = Debug|Any CPU
{684A4BB4-CF2A-45F8-9179-67EBF2848F18}.Release|Any CPU.ActiveCfg = Release|Any CPU
{684A4BB4-CF2A-45F8-9179-67EBF2848F18}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{41F367B1-2907-4A57-BCE7-253D144AEC3B} = {A0CB57C1-6B09-4FFC-A90D-232DF7099DB6}
{A300C564-B7FB-443A-A4B7-620A40DAD338} = {6DC80BC8-A821-4B35-B462-EBE28736F838}
{684A4BB4-CF2A-45F8-9179-67EBF2848F18} = {6DC80BC8-A821-4B35-B462-EBE28736F838}
EndGlobalSection
EndGlobal
2 changes: 2 additions & 0 deletions Apple.AppStoreConnect.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=kiota/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

This file was deleted.

This file was deleted.

Loading

0 comments on commit 40dccdc

Please sign in to comment.