-
-
Notifications
You must be signed in to change notification settings - Fork 3
70 lines (60 loc) · 1.84 KB
/
template.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
name: Run Tests
on:
workflow_call:
inputs:
openapi:
required: true
type: string
format:
required: true
type: string
version:
required: true
type: string
os:
type: string
default: ubuntu-latest
command:
required: true
type: string
jobs:
test:
name: ${{ inputs.openapi }}.${{ inputs.format }} (${{ inputs.version }}) ${{ inputs.os }}
runs-on: ${{ inputs.os }}
timeout-minutes: 10
strategy:
matrix:
args: [
"--output-type OneFile",
"--output-type OneRequestPerFile"
]
steps:
- name: 🛒 Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: 🛠️ Prepare OpenAPI Spec
id: prepare_openapi_spec
run: |
$filename = "./OpenAPI/${{ inputs.version }}/${{ inputs.openapi }}.${{ inputs.format }}"
$exists = Test-Path -Path $filename -PathType Leaf
if ($exists -eq $true) {
Copy-Item $filename ./openapi.${{ inputs.format }}
"exists=$true" >> $env:GITHUB_OUTPUT
} else {
"exists=$false" >> $env:GITHUB_OUTPUT
}
working-directory: test
shell: pwsh
- name: 🛠️ Generate code
run: ${{ inputs.command }} ./openapi.${{ inputs.format }} --no-logging ${{ matrix.args }}
working-directory: test
shell: pwsh
if: steps.prepare_openapi_spec.outputs.exists == 'True'
- name: 🛠️ Publish generated code as Artifact
uses: actions/upload-artifact@v3
with:
name: Generated Code (${{ inputs.openapi }}.${{ inputs.format }}, ${{ inputs.version }}, ${{ inputs.os }})
path: test/*.http
if: steps.prepare_openapi_spec.outputs.exists == 'True'