Add back macOS and Windows CI (#4101) #167
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
push: | |
# Run on version tags | |
tags: | |
- "v[0-9]*" | |
jobs: | |
build-compiler: | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
include: | |
- os: macos-14 | |
target: x86_64-apple-darwin | |
compiler-exe: slicec-cs | |
- os: macos-14 | |
target: aarch64-apple-darwin | |
compiler-exe: slicec-cs | |
- os: ubuntu-22.04 | |
target: x86_64-unknown-linux-gnu | |
compiler-exe: slicec-cs | |
- os: ubuntu-22.04 | |
target: aarch64-unknown-linux-gnu | |
compiler-exe: slicec-cs | |
- os: windows-2022 | |
target: x86_64-pc-windows-msvc | |
compiler-exe: slicec-cs.exe | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build | |
uses: ./.github/actions/build-compiler | |
with: | |
cargo-build-args: --release | |
target: ${{ matrix.target }} | |
- name: Archive Build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: slicec-cs-${{ matrix.target }} | |
path: tools/slicec-cs/target/${{ matrix.target }}/release/${{ matrix.compiler-exe }} | |
build-packages: | |
runs-on: windows-2022 | |
timeout-minutes: 10 | |
needs: build-compiler | |
env: | |
SIGN_CERTIFICATE: ${{ github.workspace }}\certificate.pfx | |
SIGN_PASSWORD: ${{ secrets.SIGN_PASSWORD }} | |
SignTool: C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x64\signtool.exe | |
SLICEC_CS_STAGING_PATH: ${{ github.workspace }}\tools\slicec-cs\staging | |
steps: | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
8.0.x | |
9.0.x | |
- uses: actions/checkout@v4 | |
- name: Create Code Signing Certificate | |
run: | | |
Set-Content -Path $env:GITHUB_WORKSPACE\certificate.pfx.base64 -Value '${{ secrets.SIGN_CERTIFICATE }}' | |
certutil -decode $env:GITHUB_WORKSPACE\certificate.pfx.base64 $env:GITHUB_WORKSPACE\certificate.pfx | |
Remove-Item $env:GITHUB_WORKSPACE\certificate.pfx.base64 | |
- name: Download slicec-cs compiler artifacts | |
uses: actions/download-artifact@v4 | |
- name: Set version from tag | |
run: | | |
$version = $env:GITHUB_REF -replace '^refs/tags/v','' | |
echo "VERSION=$version" >> $env:GITHUB_ENV | |
- name: Copy slicec-cs binaries to staging path | |
run: | | |
@("macos-x64", "macos-arm64", "linux-x64", "linux-arm64", "windows-x64") | ForEach-Object { New-Item -ItemType Directory -Path $env:GITHUB_WORKSPACE\tools\slicec-cs\staging -Name $_ } | |
Copy-Item "slicec-cs-x86_64-apple-darwin\slicec-cs" -Destination "$env:GITHUB_WORKSPACE\tools\slicec-cs\staging\macos-x64" | |
Copy-Item "slicec-cs-aarch64-apple-darwin\slicec-cs" -Destination "$env:GITHUB_WORKSPACE\tools\slicec-cs\staging\macos-arm64" | |
Copy-Item "slicec-cs-x86_64-unknown-linux-gnu\slicec-cs" -Destination "$env:GITHUB_WORKSPACE\tools\slicec-cs\staging\linux-x64" | |
Copy-Item "slicec-cs-aarch64-unknown-linux-gnu\slicec-cs" -Destination "$env:GITHUB_WORKSPACE\tools\slicec-cs\staging\linux-arm64" | |
Copy-Item "slicec-cs-x86_64-pc-windows-msvc\slicec-cs.exe" -Destination "$env:GITHUB_WORKSPACE\tools\slicec-cs\staging\windows-x64" | |
# Copy the compiler to the expected location to avoid rebuilding it when creating the NuGet packages | |
New-Item -ItemType Directory -Path "$env:GITHUB_WORKSPACE\tools\slicec-cs\target\release" | |
Copy-Item "slicec-cs-x86_64-pc-windows-msvc\slicec-cs.exe" -Destination "$env:GITHUB_WORKSPACE\tools\slicec-cs\target\release" | |
- name: Build IceRPC Tools | |
working-directory: tools | |
run: dotnet build --configuration Release | |
- name: Build IceRPC | |
run: dotnet build --configuration Release | |
- name: Pack IceRPC Tools | |
working-directory: tools | |
run: dotnet pack --configuration Release --output ../ | |
- name: Pack IceRPC | |
run: dotnet pack --configuration Release --output . | |
- name: Pack IceRPC Templates | |
working-directory: src/IceRpc.Templates | |
run: dotnet pack --configuration Release --output ../../ | |
- name: Upload packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages | |
path: | | |
./*.nupkg | |
./*.snupkg | |
- name: Cleanup | |
if: always() | |
run: Remove-Item $env:GITHUB_WORKSPACE\certificate.pfx -ErrorAction SilentlyContinue | |
test-packages: | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
include: | |
- os: macos-14 | |
- os: ubuntu-22.04 | |
- os: windows-2022 | |
runs-on: ${{ matrix.os }} | |
needs: build-packages | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
8.0.x | |
9.0.x | |
- name: Initialize NuGet local cache | |
run: dotnet restore | |
- name: Download packages artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: packages | |
path: packages | |
- name: Configure NuGet sources | |
run: | | |
dotnet new nugetconfig -o ${{ github.workspace }} | |
dotnet nuget add source --configfile ${{ github.workspace }}/nuget.config -n "Local Packages" ${{ github.workspace }}/packages | |
shell: pwsh | |
- name: Install dotnet new templates | |
working-directory: packages | |
run: | | |
$version = $env:GITHUB_REF -replace '^refs/tags/v','' | |
dotnet new install IceRpc.Templates::$version | |
shell: pwsh | |
- name: 🔨 Build Examples | |
run: | | |
$examples = Get-ChildItem -Path examples -Recurse -Include *.sln | |
foreach ($example in $examples) { dotnet build $example.FullName } | |
shell: pwsh | |
- name: 🧪 Test Templates | |
uses: ./.github/actions/test-templates |