-
Notifications
You must be signed in to change notification settings - Fork 234
149 lines (142 loc) · 5.14 KB
/
idempotency-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: idempotency-tests
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
concurrency:
# Only run once for latest commit per ref and cancel other (previous) runs.
group: ci-idempotency-tests-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.x
- name: Restore dependencies
run: dotnet restore kiota.sln
- name: Build
run: dotnet publish ./src/kiota/kiota.csproj -c Release -p:PublishSingleFile=true -p:PublishReadyToRun=true -o ./publish -f net9.0
# -p:PublishTrimmed=true -p:PublishAot=true should be enabled to make test run faster, but there are still limitations
- uses: actions/upload-artifact@v4
with:
name: generator
path: publish
download-openapi-specs:
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
description:
- "oas::petstore"
- "apisguru::twitter.com:current"
- "apisguru::notion.com"
- "apisguru::stripe.com"
- "https://raw.githubusercontent.com/googlemaps/openapi-specification/main/dist/google-maps-platform-openapi3.yml"
- "apisguru::meraki.com"
- "https://developers.pipedrive.com/docs/api/v1/openapi.yaml"
- "apisguru::twilio.com:api"
- "apisguru::docusign.net"
- "apisguru::github.com:api.github.com"
- "apisguru::apis.guru"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: generator
path: publish
- run: chmod a+x ./publish/kiota
- name: Download OpenAPI specs
run: ./it/download-openapi-specs.ps1 -descriptionUrl ${{ matrix.description }}
shell: pwsh
- id: replace_url
run: ./it/get-description-artifact-key.ps1 -descriptionUrl ${{ matrix.description }}
shell: pwsh
- uses: actions/upload-artifact@v4
with:
name: description-${{ steps.replace_url.outputs.ARTKEY }}
path: it/openapi.yaml
idempotency:
runs-on: ubuntu-latest
needs: download-openapi-specs
strategy:
fail-fast: false
matrix:
language:
- java
- csharp
- go
- typescript
- ruby
- php
- python
- dart
description:
- "./tests/Kiota.Builder.IntegrationTests/InheritingErrors.yaml"
- "./tests/Kiota.Builder.IntegrationTests/NoUnderscoresInModel.yaml"
- "oas::petstore"
- "apisguru::twitter.com:current"
- "apisguru::notion.com"
- "apisguru::stripe.com"
- "https://raw.githubusercontent.com/googlemaps/openapi-specification/main/dist/google-maps-platform-openapi3.yml"
- "apisguru::meraki.com"
- "https://developers.pipedrive.com/docs/api/v1/openapi.yaml"
- "apisguru::twilio.com:api"
- "apisguru::docusign.net"
- "apisguru::github.com:api.github.com"
- "apisguru::apis.guru"
steps:
- uses: actions/checkout@v4
- id: replace_url
run: ./it/get-description-artifact-key.ps1 -descriptionUrl ${{ matrix.description }}
shell: pwsh
- uses: actions/download-artifact@v4
if: startsWith(matrix.description, './') != true
with:
name: description-${{ steps.replace_url.outputs.ARTKEY }}
path: description
- uses: actions/download-artifact@v4
with:
name: generator
path: publish
- run: chmod a+x ./publish/kiota
- name: Check if test is suppressed
id: check-suppressed
run: |
$isSuppressed = . ./it/get-is-suppressed.ps1 -descriptionUrl ${{ matrix.description }} -language ${{ matrix.language }} -kind idempotency
Write-Output "IS_SUPPRESSED=$($isSuppressed.ToString().ToLowerInvariant())" >> $Env:GITHUB_OUTPUT
shell: pwsh
- name: Verify idempotency
shell: pwsh
run: ./it/compare-generation.ps1 -descriptionUrl "${{ steps.replace_url.outputs.DESCRIPTION_PATH }}" -language "${{ matrix.language }}"
continue-on-error: ${{ steps.check-suppressed.outputs.IS_SUPPRESSED == 'true' }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: idempotency-${{ matrix.language }}-${{ steps.replace_url.outputs.ARTKEY }}
path: idempotency-results/*.zip
cleanup:
runs-on: ubuntu-latest
needs: idempotency
steps:
- uses: jimschubert/delete-artifacts-action@v1
with:
artifact_name: "generator"
min_bytes: "0"
# Aggregates result of the idempotency tests for use in branch policy
check-idempotency-tests:
runs-on: ubuntu-latest
needs: idempotency
if: always()
steps:
- name: All build matrix options are successful
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: One or more build matrix options failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1