Skip to content

Commit

Permalink
Merge pull request #469 from vandsh/osx-arm64-support
Browse files Browse the repository at this point in the history
Osx arm64 support
  • Loading branch information
guythetechie authored Feb 1, 2024
2 parents e563b3e + 78edbf1 commit c132c63
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 30 deletions.
42 changes: 26 additions & 16 deletions .github/workflows/create_github_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
name: Generate extractor artifacts
strategy:
matrix:
dotnet-runtime: [linux-x64, linux-arm64, win-x64]
dotnet-runtime: [linux-x64, linux-arm64, win-x64, osx-arm64]
# Dynamically set the runner OS based on the .NET runtime
runs-on: ${{ fromJSON('{"linux-x64":"ubuntu-latest", "linux-arm64":"ubuntu-latest", "win-x64":"windows-latest"}')[matrix.dotnet-runtime] }}
runs-on: ${{ fromJSON('{"linux-x64":"ubuntu-latest", "linux-arm64":"ubuntu-latest", "win-x64":"windows-latest", "osx-arm64":"macos-latest"}')[matrix.dotnet-runtime] }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -39,25 +39,29 @@ jobs:
& dotnet publish "$sourcePath" --self-contained --runtime "${{ matrix.dotnet-runtime }}" -p:PublishSingleFile=true --output "$outputFolderPath"
if ($LASTEXITCODE -ne 0) { throw "Generating extractor failed."}
$exeFileName = "${{ matrix.dotnet-runtime }}".Contains("win") ? "extractor.exe" : "extractor"
$exeFolderPath = Join-Path "$outputFolderPath" "$exeFileName"
Rename-Item -Path "$exeFolderPath" -NewName "${{ format('extractor.{0}.exe', matrix.dotnet-runtime) }}"
$exeFileExt = "${{ matrix.dotnet-runtime }}".Contains("win") ? ".exe" : ""
$exeFolderPath = Join-Path "$outputFolderPath" "extractor$exeFileExt"
$exeFileNameFinal = "${{ format('extractor.{0}', matrix.dotnet-runtime) }}$exeFileExt"
Rename-Item -Path "$exeFolderPath" -NewName $exeFileNameFinal
echo "EXTRACTOR_FILENAME=$exeFileNameFinal" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Information "Execution complete."
shell: pwsh
env:
EXTRACTOR_FILENAME:

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
path: ${{ format('{0}/extractor.{1}.exe', runner.temp, matrix.dotnet-runtime) }}
path: ${{ format('{0}/{1}', runner.temp, env.EXTRACTOR_FILENAME) }}

generate_publisher_artifacts:
name: Generate publisher artifacts
strategy:
matrix:
dotnet-runtime: [linux-x64, linux-arm64, win-x64]
dotnet-runtime: [linux-x64, linux-arm64, win-x64, osx-arm64]
# Dynamically set the runner OS based on the .NET runtime
runs-on: ${{ fromJSON('{"linux-x64":"ubuntu-latest", "linux-arm64":"ubuntu-latest", "win-x64":"windows-latest"}')[matrix.dotnet-runtime] }}
runs-on: ${{ fromJSON('{"linux-x64":"ubuntu-latest", "linux-arm64":"ubuntu-latest", "win-x64":"windows-latest", "osx-arm64":"macos-latest"}')[matrix.dotnet-runtime] }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -81,17 +85,21 @@ jobs:
& dotnet publish "$sourcePath" --self-contained --runtime "${{ matrix.dotnet-runtime }}" -p:PublishSingleFile=true --output "$outputFolderPath"
if ($LASTEXITCODE -ne 0) { throw "Generating publisher failed."}
$exeFileName = "${{ matrix.dotnet-runtime }}".Contains("win") ? "publisher.exe" : "publisher"
$exeFolderPath = Join-Path "$outputFolderPath" "$exeFileName"
Rename-Item -Path "$exeFolderPath" -NewName "${{ format('publisher.{0}.exe', matrix.dotnet-runtime) }}"
$exeFileExt = "${{ matrix.dotnet-runtime }}".Contains("win") ? ".exe" : ""
$exeFolderPath = Join-Path "$outputFolderPath" "publisher$exeFileExt"
$exeFileNameFinal = "${{ format('publisher.{0}', matrix.dotnet-runtime) }}$exeFileExt"
Rename-Item -Path "$exeFolderPath" -NewName $exeFileNameFinal
echo "PUBLISHER_FILENAME=$exeFileNameFinal" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Information "Execution complete."
shell: pwsh
env:
PUBLISHER_FILENAME:

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
path: ${{ format('{0}/publisher.{1}.exe', runner.temp, matrix.dotnet-runtime) }}
path: ${{ format('{0}/{1}', runner.temp, env.PUBLISHER_FILENAME) }}

generate_github_pipeline_artifacts:
name: Generate GitHub artifacts
Expand Down Expand Up @@ -223,11 +231,13 @@ jobs:
with:
files: |
${{github.workspace}}/artifact/extractor.win-x64.exe
${{github.workspace}}/artifact/extractor.linux-x64.exe
${{github.workspace}}/artifact/extractor.linux-arm64.exe
${{github.workspace}}/artifact/extractor.linux-x64
${{github.workspace}}/artifact/extractor.linux-arm64
${{github.workspace}}/artifact/extractor.osx-arm64
${{github.workspace}}/artifact/publisher.win-x64.exe
${{github.workspace}}/artifact/publisher.linux-x64.exe
${{github.workspace}}/artifact/publisher.linux-arm64.exe
${{github.workspace}}/artifact/publisher.linux-x64
${{github.workspace}}/artifact/publisher.linux-arm64
${{github.workspace}}/artifact/publisher.osx-arm64
${{github.workspace}}/artifact/Github.zip
${{github.workspace}}/artifact/Azure_DevOps.zip
name: APIOps Toolkit for Azure APIM ${{ github.event.inputs.Release_Version }}
Expand Down
12 changes: 10 additions & 2 deletions tools/azdo_pipelines/run-extractor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,17 @@ stages:
$InformationPreference = "Continue"
Write-Information "Downloading extractor..."
$extractorFileName = "$(Agent.OS)" -like "*win*" ? "extractor.win-x64.exe" : "extractor.linux-x64.exe"
$extractorFileName = "extractor.linux-x64"
$extractorFinalFileName = "extractor"
if("$(Agent.OS)" -like "*win*"){
$extractorFileName = "extractor.win-x64.exe"
$extractorFinalFileName = "extractor.exe"
}
else if("$(Agent.OS)" -like "*mac*" && "$(Agent.OSArchitecture)" -like "*arm*"){
$extractorFileName = "extractor.osx-arm64"
}
$uri = "https://github.com/Azure/apiops/releases/download/$(apiops_release_version)/$extractorFileName"
$destinationFilePath = Join-Path "$(Agent.TempDirectory)" "extractor.exe"
$destinationFilePath = Join-Path "$(Agent.TempDirectory)" $extractorFinalFileName
Invoke-WebRequest -Uri "$uri" -OutFile "$destinationFilePath"
if ("$(Agent.OS)" -like "*linux*")
Expand Down
13 changes: 11 additions & 2 deletions tools/azdo_pipelines/run-publisher-with-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,18 @@ steps:
$InformationPreference = "Continue"
Write-Information "Downloading publisher..."
$publisherFileName = "$(Agent.OS)" -like "*win*" ? "publisher.win-x64.exe" : "publisher.linux-x64.exe"
$publisherFileName = "publisher.linux-x64"
$publisherFinalFileName = "publisher"
if("$(Agent.OS)" -like "*win*"){
$publisherFileName = "publisher.win-x64.exe"
$publisherFinalFileName = "publisher.exe"
}
else if("$(Agent.OS)" -like "*mac*" && "$(Agent.OSArchitecture)" -like "*arm*"){
$publisherFileName = "publisher.osx-arm64"
}
$uri = "https://github.com/Azure/apiops/releases/download/$(apiops_release_version)/$publisherFileName"
$destinationFilePath = Join-Path "$(Agent.TempDirectory)" "publisher.exe"
$destinationFilePath = Join-Path "$(Agent.TempDirectory)" $publisherFinalFileName
Invoke-WebRequest -Uri "$uri" -OutFile "$destinationFilePath"
if ("$(Agent.OS)" -like "*linux*")
Expand Down
13 changes: 11 additions & 2 deletions tools/github_workflows/run-extractor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,18 @@ jobs:
$InformationPreference = "Continue"
Write-Information "Downloading extractor..."
$extractorFileName = "${{ runner.os }}" -like "*win*" ? "extractor.win-x64.exe" : "extractor.linux-x64.exe"
$extractorFileName = "extractor.linux-x64"
$extractorFinalFileName = "extractor"
if("${{ runner.os }}" -like "*win*"){
$extractorFileName = "extractor.win-x64.exe"
$extractorFinalFileName = "extractor.exe"
}
else if("${{ runner.os }}" -like "*mac*" && "${{ runner.arch }}" -like "*arm*"){
$extractorFileName = "extractor.osx-arm64"
}
$uri = "https://github.com/Azure/apiops/releases/download/${{ env.apiops_release_version }}/$extractorFileName"
$destinationFilePath = Join-Path "${{ runner.temp }}" "extractor.exe"
$destinationFilePath = Join-Path "${{ runner.temp }}" $extractorFinalFileName
Invoke-WebRequest -Uri "$uri" -OutFile "$destinationFilePath"
if ("${{ runner.os }}" -like "*linux*")
Expand Down
52 changes: 44 additions & 8 deletions tools/github_workflows/run-publisher-with-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,18 @@ jobs:
$InformationPreference = "Continue"
Write-Information "Downloading publisher..."
$publisherFileName = "${{ runner.os }}" -like "*win*" ? "publisher.win-x64.exe" : "publisher.linux-x64.exe"
$publisherFileName = "publisher.linux-x64"
$publisherFinalFileName = "publisher"
if("${{ runner.os }}" -like "*win*"){
$publisherFileName = "publisher.win-x64.exe"
$publisherFinalFileName = "publisher.exe"
}
else if("${{ runner.os }}" -like "*mac*" && "${{ runner.arch }}" -like "*arm*"){
$publisherFileName = "publisher.osx-arm64"
}
$uri = "https://github.com/Azure/apiops/releases/download/${{ env.apiops_release_version }}/$publisherFileName"
$destinationFilePath = Join-Path "${{ runner.temp }}" "publisher.exe"
$destinationFilePath = Join-Path "${{ runner.temp }}" $publisherFinalFileName
Invoke-WebRequest -Uri "$uri" -OutFile "$destinationFilePath"
if ("${{ runner.os }}" -like "*linux*")
Expand Down Expand Up @@ -104,9 +113,18 @@ jobs:
$InformationPreference = "Continue"
Write-Information "Downloading publisher..."
$publisherFileName = "${{ runner.os }}" -like "*win*" ? "publisher.win-x64.exe" : "publisher.linux-x64.exe"
$publisherFileName = "publisher.linux-x64"
$publisherFinalFileName = "publisher"
if("${{ runner.os }}" -like "*win*"){
$publisherFileName = "publisher.win-x64.exe"
$publisherFinalFileName = "publisher.exe"
}
else if("${{ runner.os }}" -like "*mac*" && "${{ runner.arch }}" -like "*arm*"){
$publisherFileName = "publisher.osx-arm64"
}
$uri = "https://github.com/Azure/apiops/releases/download/${{ env.apiops_release_version }}/$publisherFileName"
$destinationFilePath = Join-Path "${{ runner.temp }}" "publisher.exe"
$destinationFilePath = Join-Path "${{ runner.temp }}" $publisherFinalFileName
Invoke-WebRequest -Uri "$uri" -OutFile "$destinationFilePath"
if ("${{ runner.os }}" -like "*linux*")
Expand Down Expand Up @@ -141,9 +159,18 @@ jobs:
$InformationPreference = "Continue"
Write-Information "Downloading publisher..."
$publisherFileName = "${{ runner.os }}" -like "*win*" ? "publisher.win-x64.exe" : "publisher.linux-x64.exe"
$publisherFileName = "publisher.linux-x64"
$publisherFinalFileName = "publisher"
if("${{ runner.os }}" -like "*win*"){
$publisherFileName = "publisher.win-x64.exe"
$publisherFinalFileName = "publisher.exe"
}
else if("${{ runner.os }}" -like "*mac*" && "${{ runner.arch }}" -like "*arm*"){
$publisherFileName = "publisher.osx-arm64"
}
$uri = "https://github.com/Azure/apiops/releases/download/${{ env.apiops_release_version }}/$publisherFileName"
$destinationFilePath = Join-Path "${{ runner.temp }}" "publisher.exe"
$destinationFilePath = Join-Path "${{ runner.temp }}" $publisherFinalFileName
Invoke-WebRequest -Uri "$uri" -OutFile "$destinationFilePath"
if ("${{ runner.os }}" -like "*linux*")
Expand Down Expand Up @@ -177,9 +204,18 @@ jobs:
$InformationPreference = "Continue"
Write-Information "Downloading publisher..."
$publisherFileName = "${{ runner.os }}" -like "*win*" ? "publisher.win-x64.exe" : "publisher.linux-x64.exe"
$publisherFileName = "publisher.linux-x64"
$publisherFinalFileName = "publisher"
if("${{ runner.os }}" -like "*win*"){
$publisherFileName = "publisher.win-x64.exe"
$publisherFinalFileName = "publisher.exe"
}
else if("${{ runner.os }}" -like "*mac*" && "${{ runner.arch }}" -like "*arm*"){
$publisherFileName = "publisher.osx-arm64"
}
$uri = "https://github.com/Azure/apiops/releases/download/${{ env.apiops_release_version }}/$publisherFileName"
$destinationFilePath = Join-Path "${{ runner.temp }}" "publisher.exe"
$destinationFilePath = Join-Path "${{ runner.temp }}" $publisherFinalFileName
Invoke-WebRequest -Uri "$uri" -OutFile "$destinationFilePath"
if ("${{ runner.os }}" -like "*linux*")
Expand Down

0 comments on commit c132c63

Please sign in to comment.