Skip to content

Commit e270e91

Browse files
authored
Merge pull request #804 from microsoftgraph/ci/separate-hidi-install
ci: installs hidi outside of the script
2 parents 19e663c + f6c0d6a commit e270e91

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

.github/workflows/metadata-parser-validation.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ jobs:
3333
- name: Setup .NET
3434
uses: actions/[email protected]
3535
with:
36-
dotnet-version: 8.0.x
36+
dotnet-version: 9.x
37+
38+
- run: dotnet tool install --global Microsoft.OpenApi.Hidi
39+
name: Install Hidi
3740

3841
- name: Validate latest XSLT rules
3942
run: ./scripts/run-metadata-validation.ps1 -repoDirectory "${{ github.workspace }}" -version "${{ matrix.version }}" -platformName "${{ matrix.settings }}"

.github/workflows/openapi-parser-validation.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ jobs:
3333
- name: Setup .NET
3434
uses: actions/[email protected]
3535
with:
36-
dotnet-version: 8.0.x
36+
dotnet-version: 9.x
37+
38+
- run: dotnet tool install --global Microsoft.OpenApi.Hidi
39+
name: Install Hidi
40+
3741
- name: Validate latest OpenAPI docs
3842
run: ./scripts/run-openapi-validation.ps1 -repoDirectory "${{ github.workspace }}" -version "${{ matrix.version }}" -platformName "${{ matrix.settings }}"
3943
shell: pwsh

scripts/run-metadata-validation.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ if([string]::IsNullOrWhiteSpace($platformName))
2626
$platformName = "openapi"
2727
}
2828

29+
$hidiResults = dotnet tool list microsoft.openapi.hidi -g --format json | ConvertFrom-json
30+
if ($hidiResults.data.Length -lt 1) {
31+
throw "Hidi tool is not installed. Please install it using the command: dotnet tool install --global Microsoft.OpenApi.Hidi"
32+
}
33+
2934
$transformCsdlDirectory = Join-Path $repoDirectory "transforms/csdl"
3035
$transformScript = Join-Path $transformCsdlDirectory "transform.ps1"
3136
$xsltPath = Join-Path $transformCsdlDirectory "preprocess_csdl.xsl"
@@ -37,12 +42,10 @@ $transformed = Join-Path $repoDirectory "transformed_$($version)_metadata.xml"
3742
$yamlFilePath = Join-Path $repoDirectory "transformed_$($version)_$($platformName)_metadata.yml"
3843

3944
try {
40-
Write-Host "Tranforming $snapshot metadata using xslt with parameters used in the OpenAPI flow..." -ForegroundColor Green
45+
Write-Host "Transforming $snapshot metadata using xslt with parameters used in the OpenAPI flow..." -ForegroundColor Green
4146
& $transformScript -xslPath $xsltPath -inputPath $snapshot -outputPath $transformed -addInnerErrorDescription $true -removeCapabilityAnnotations $false -csdlVersion $version
4247

4348
Write-Host "Validating $transformed metadata after the transform..." -ForegroundColor Green
44-
# pin the hidi version till odata to openApi conversion supports 2.0
45-
& dotnet tool install --global Microsoft.OpenApi.Hidi
4649
& hidi transform --cs $transformed -o $yamlFilePath --co -f Yaml --sp "$conversionSettingsDirectory/$platformName.json"
4750

4851
} catch {

scripts/run-openapi-validation.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ if([string]::IsNullOrWhiteSpace($platformName))
3232
$platformName = "openapi"
3333
}
3434

35+
$hidiResults = dotnet tool list microsoft.openapi.hidi -g --format json | ConvertFrom-json
36+
if ($hidiResults.data.Length -lt 1) {
37+
throw "Hidi tool is not installed. Please install it using the command: dotnet tool install --global Microsoft.OpenApi.Hidi"
38+
}
39+
3540
$yaml = Join-Path $repoDirectory "openapi" $version "$platformName.yaml"
3641

3742
Write-Host "Validating $yaml OpenAPI doc..." -ForegroundColor Green
3843

39-
# pin the hidi version till odata to openApi conversion supports 2.0
40-
& dotnet tool install --global Microsoft.OpenApi.Hidi
4144
& hidi validate -d $yaml

0 commit comments

Comments
 (0)