Skip to content

Commit

Permalink
Linux/Windows support (#13)
Browse files Browse the repository at this point in the history
lemonmojo authored Nov 6, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent c2621e0 commit 263560a
Showing 770 changed files with 116,324 additions and 586 deletions.
190 changes: 190 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
name: CI

on:
push: # trigger on commits to the `main` branch (no PRs)
branches:
- main
paths-ignore:
- '.github/workflows/x-*.yml'
workflow_dispatch: # and manually-triggered runs

permissions:
# only allowed to read source code (ref. https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs)
contents: read

concurrency:
# cancel pending runs when a PR gets updated
group: "${{ github.head_ref || github.run_id }}-${{ github.actor }}"
cancel-in-progress: true

jobs:
build:
name: "CI - ${{ matrix.name }}"

strategy:
matrix:
include:
- name: "Ubuntu ARM64"
os: ubuntu-24-arm64-gh
env:
OS: "linux"
NUGET_RID: "linux-arm64"

- name: "Ubuntu x64"
os: ubuntu-latest
env:
OS: "linux"
NUGET_RID: "linux-x64"

- name: "macOS ARM64"
os: macos-14
env:
OS: "apple"
NUGET_RID: "osx"

- name: "Windows x64"
os: windows-latest
env:
OS: "windows"
NUGET_RID: "win-x64"
NUGET_PACK_DOTNET_LIB: "1"

#- name: "Windows ARM64"
# os: windows-11-arm64-gh
# env:
# OS: "windows"
# NUGET_RID: "win-arm64"

runs-on: "${{ matrix.os }}"

defaults:
run:
shell: "${{ matrix.env.OS == 'windows' && 'pwsh' || 'bash' }}"

env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
VCPKG_DISABLE_METRICS: 1
NUGET_BASE_VERSION: "0.0"
ROYALVNC_BUILD_DEBUG: 0
SWIFT_VERSION: "6.0.2"

steps:
#- name: setup tools (win-arm64)
# if: "success() && matrix.env.NUGET_RID == 'win-arm64'"
# shell: powershell
# run: |
# # Install choco
# Set-ExecutionPolicy Bypass -Scope Process -Force
# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 # Enable TLS1.2
# Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# "C:\ProgramData\Chocolatey\bin" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
#
# # Install pwsh
# choco install -y --no-progress powershell-core
# "C:\Program Files\PowerShell\7" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
#
# # Install git
# choco install -y --no-progress git
# "C:\Program Files\Git\cmd" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
#
# # Install dotnet
# Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://dot.net/v1/dotnet-install.ps1'))
# "C:\Program Files\dotnet" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8

- name: checkout
uses: actions/checkout@v4

# setup build environment

- name: setup environment (Apple)
if: "success() && matrix.env.OS == 'apple'"
run: |
sudo xcode-select --switch /Applications/Xcode_16.0.app
- name: setup VC++ environment (Windows)
if: "success() && matrix.env.OS == 'windows'"
uses: compnerd/gha-setup-vsdevenv@v6

- name: setup Swift (Windows)
if: "success() && matrix.env.OS == 'windows'"
uses: compnerd/[email protected]
with:
branch: "swift-${{ env.SWIFT_VERSION }}-release"
tag: "${{ env.SWIFT_VERSION }}-RELEASE"

# build RoyalVNCKit

- name: build RoyalVNCKit (Apple)
if: "success() && matrix.env.OS == 'apple'"
run: |
swift package clean --configuration release
swift build --configuration release --arch arm64
swift build --configuration release --arch x86_64
mkdir -p .build/universal-apple-macosx/release
lipo -create \
.build/arm64-apple-macosx/release/libRoyalVNCKit.dylib \
.build/x86_64-apple-macosx/release/libRoyalVNCKit.dylib \
-output .build/universal-apple-macosx/release/libRoyalVNCKit.dylib
- name: build RoyalVNCKit
if: "success() && matrix.env.OS != 'apple'"
run: |
swift package clean --configuration release
swift build --configuration release
# .NET bindings and NuGet package artifacts

- name: build .NET bindings
run: |
dotnet build --configuration Release Bindings/dotnet/RoyalApps.RoyalVNCKit.sln
- name: create native NuGet package
if: "success() && matrix.env.NUGET_RID != ''"
env:
NUGET_VERSION: "${{ env.NUGET_BASE_VERSION }}.${{ github.run_number }}"
NUGET_RID: "${{ matrix.env.NUGET_RID }}"
NUGET_GIT_COMMIT: "${{ github.sha }}"
NUGET_SWIFT_RT_VERSION: "${{ env.SWIFT_VERSION }}"
run: |
pwsh Bindings/dotnet/nuget-pack-native.ps1
#- name: test AOT build and interop
# if: "success() && matrix.env.NUGET_RID != ''"
# env:
# NUGET_VERSION: "${{ env.NUGET_BASE_VERSION }}.${{ github.run_number }}"
# NUGET_RID: "${{ matrix.env.NUGET_RID }}"
# run: |
# pwsh Bindings/dotnet/nuget-test-aot.ps1

- name: create NuGet package
if: "success() && matrix.env.NUGET_PACK_DOTNET_LIB == '1'"
env:
NUGET_VERSION: "${{ env.NUGET_BASE_VERSION }}.${{ github.run_number }}"
NUGET_GIT_COMMIT: "${{ github.sha }}"
run: |
pwsh Bindings/dotnet/nuget-pack-dotnet.ps1
- name: publish native NuGet packages
if: "success() && matrix.env.NUGET_RID != ''"
uses: actions/upload-artifact@v4
with:
name: "RoyalApps.RoyalVNCKit.native.${{ matrix.env.NUGET_RID }}"
retention-days: 5
if-no-files-found: "error"
path: |
Bindings/dotnet/RoyalApps.RoyalVNCKit.native/bin/Release/RoyalApps.*.nupkg
- name: publish NuGet package
if: "success() && matrix.env.NUGET_PACK_DOTNET_LIB == '1'"
uses: actions/upload-artifact@v4
with:
name: "RoyalApps.RoyalVNCKit"
retention-days: 5
if-no-files-found: "error"
path: |
Bindings/dotnet/RoyalApps.RoyalVNCKit/bin/Release/RoyalApps.RoyalVNCKit.*.nupkg
165 changes: 165 additions & 0 deletions .github/workflows/x-win-arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
name: Experiment-Windows-ARM64
on:
workflow_dispatch: # manually-triggered runs

permissions:
# only allowed to read source code (ref. https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs)
contents: read

concurrency:
# cancel pending runs when a PR gets updated
group: "${{ github.head_ref || github.run_id }}-${{ github.actor }}"
cancel-in-progress: true

jobs:
build:
name: "X-Win - ${{ matrix.name }}"

strategy:
matrix:
include:
- name: "Windows ARM64"
os: windows-11-arm64-gh
env:
OS: "windows"
NUGET_RID: "win-arm64"

runs-on: "${{ matrix.os }}"

defaults:
run:
shell: "${{ matrix.env.OS == 'windows' && 'pwsh' || 'bash' }}"

env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
VCPKG_DISABLE_METRICS: 1
NUGET_BASE_VERSION: "0.0"
ROYALVNC_BUILD_DEBUG: 0
SWIFT_VERSION: "6.0.2"

steps:
- name: test
shell: cmd
run: |
set
where winget
winget --version
exit 1
- name: setup tools (win-arm64)
if: "success() && matrix.env.NUGET_RID == 'win-arm64'"
shell: powershell
run: |
# Install choco
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 # Enable TLS1.2
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
"C:\ProgramData\Chocolatey\bin" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
# Install pwsh
choco install -y --no-progress powershell-core
"C:\Program Files\PowerShell\7" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
# Install git
choco install -y --no-progress git
"C:\Program Files\Git\cmd" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
# Install dotnet
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://dot.net/v1/dotnet-install.ps1'))
"C:\Program Files\dotnet" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
- name: checkout
uses: actions/checkout@v4

# setup build environment

- name: setup environment (Apple)
if: "success() && matrix.env.OS == 'apple'"
run: |
sudo xcode-select --switch /Applications/Xcode_16.0.app
- name: setup VC++ environment (Windows)
if: "success() && matrix.env.OS == 'windows'"
uses: compnerd/gha-setup-vsdevenv@v6

- name: setup Swift (Windows)
if: "success() && matrix.env.OS == 'windows'"
uses: compnerd/[email protected]
with:
branch: "swift-${{ env.SWIFT_VERSION }}-release"
tag: "${{ env.SWIFT_VERSION }}-RELEASE"

# build RoyalVNCKit

- name: build RoyalVNCKit (Apple)
if: "success() && matrix.env.OS == 'apple'"
run: |
swift package clean --configuration release
swift build --configuration release --arch arm64
swift build --configuration release --arch x86_64
mkdir -p .build/universal-apple-macosx/release
lipo -create \
.build/arm64-apple-macosx/release/libRoyalVNCKit.dylib \
.build/x86_64-apple-macosx/release/libRoyalVNCKit.dylib \
-output .build/universal-apple-macosx/release/libRoyalVNCKit.dylib
- name: build RoyalVNCKit
if: "success() && matrix.env.OS != 'apple'"
run: |
swift package clean --configuration release
swift build --configuration release
# .NET bindings and NuGet package artifacts

- name: build .NET bindings
run: |
dotnet build --configuration Release Bindings/dotnet/RoyalApps.RoyalVNCKit.sln
- name: create native NuGet package
if: "success() && matrix.env.NUGET_RID != ''"
env:
NUGET_VERSION: "${{ env.NUGET_BASE_VERSION }}.${{ github.run_number }}"
NUGET_RID: "${{ matrix.env.NUGET_RID }}"
NUGET_GIT_COMMIT: "${{ github.sha }}"
NUGET_SWIFT_RT_VERSION: "${{ env.SWIFT_VERSION }}"
run: |
pwsh Bindings/dotnet/nuget-pack-native.ps1
#- name: test AOT build and interop
# if: "success() && matrix.env.NUGET_RID != ''"
# env:
# NUGET_VERSION: "${{ env.NUGET_BASE_VERSION }}.${{ github.run_number }}"
# NUGET_RID: "${{ matrix.env.NUGET_RID }}"
# run: |
# pwsh Bindings/dotnet/nuget-test-aot.ps1

- name: create NuGet package
if: "success() && matrix.env.NUGET_PACK_DOTNET_LIB == '1'"
env:
NUGET_VERSION: "${{ env.NUGET_BASE_VERSION }}.${{ github.run_number }}"
NUGET_GIT_COMMIT: "${{ github.sha }}"
run: |
pwsh Bindings/dotnet/nuget-pack-dotnet.ps1
- name: publish native NuGet packages
if: "success() && matrix.env.NUGET_RID != ''"
uses: actions/upload-artifact@v4
with:
name: "RoyalApps.RoyalVNCKit.native.${{ matrix.env.NUGET_RID }}"
retention-days: 5
if-no-files-found: "error"
path: |
Bindings/dotnet/RoyalApps.RoyalVNCKit.native/bin/Release/RoyalApps.*.nupkg
- name: publish NuGet package
if: "success() && matrix.env.NUGET_PACK_DOTNET_LIB == '1'"
uses: actions/upload-artifact@v4
with:
name: "RoyalApps.RoyalVNCKit"
retention-days: 5
if-no-files-found: "error"
path: |
Bindings/dotnet/RoyalApps.RoyalVNCKit/bin/Release/RoyalApps.RoyalVNCKit.*.nupkg
Loading

0 comments on commit 263560a

Please sign in to comment.