Skip to content

Commit

Permalink
feat: Enhance Linux, Windows and macOS packaging support
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Oct 16, 2024
1 parent a8750e4 commit ddbdbbb
Show file tree
Hide file tree
Showing 11 changed files with 199 additions and 114 deletions.
28 changes: 26 additions & 2 deletions build/ci/.azure-devops-project-template-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
TestGroup: '2'
group_3:
TestGroup: '3'
group_4:
TestGroup: '4'

steps:
- task: DownloadBuildArtifacts@0
Expand Down Expand Up @@ -73,6 +75,8 @@ jobs:
TestGroup: '2'
group_3:
TestGroup: '3'
group_4:
TestGroup: '4'

steps:
- task: DownloadBuildArtifacts@0
Expand Down Expand Up @@ -109,8 +113,6 @@ jobs:

pool: ${{ parameters.vmPoolLinux }}

container: unoplatform/wasm-build:2.3

strategy:
matrix:
group_0:
Expand All @@ -136,6 +138,28 @@ jobs:

- template: templates/dotnet-install.yml

- bash: |
set -x
sudo snap install core24
sudo snap install lxd
sudo snap install multipass
sudo snap install snapcraft --classic
export PATH=$PATH:/snap/bin
sudo chown root:root /
sudo /snap/bin/lxd.migrate -yes
sudo /snap/bin/lxd waitready
sudo /snap/bin/lxd init --auto
echo Adding $USER to group lxd
sudo usermod --append --groups lxd $USER
sudo apt install iptables
sudo iptables -I DOCKER-USER -i lxdbr0 -j ACCEPT
sudo iptables -I DOCKER-USER -o lxdbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
displayName: Setup Snapcraft
- pwsh: build/test-scripts/run-net7-template-linux.ps1 -TestGroup "$(TestGroup)"
displayName: Run Project Templates Tests
env:
Expand Down
3 changes: 2 additions & 1 deletion build/ci/templates/dotnet-mobile-install-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ steps:
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install -y msopenjdk-11
sudo update-java-alternatives --set msopenjdk-11-amd64
displayName: Install OpenJDK 11
retryCountOnTaskFailure: 3
- bash: |
dotnet tool update --global uno.check --version ${{ parameters.UnoCheck_Version }} --add-source https://api.nuget.org/v3/index.json
uno-check --ci --non-interactive --fix --skip gtk3 --skip androidsdk --pre-major
uno-check --verbose --ci --non-interactive --fix --skip gtk3 --skip androidsdk --pre-major
displayName: Install .NET Workloads
retryCountOnTaskFailure: 3
70 changes: 41 additions & 29 deletions build/test-scripts/run-net7-template-linux.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,48 +37,52 @@ Get-ChildItem -Recurse -Filter global.json | ForEach-Object {
$projects =
@(
# 5.0 and earlier
@(0, "UnoAppWinUILinuxValidation/UnoAppWinUILinuxValidation.Wasm/UnoAppWinUILinuxValidation.Wasm.csproj", ""),
@(0, "UnoAppWinUILinuxValidation/UnoAppWinUILinuxValidation.Skia.Gtk/UnoAppWinUILinuxValidation.Skia.Gtk.csproj", ""),
@(0, "UnoAppWinUILinuxValidation/UnoAppWinUILinuxValidation.Skia.Linux.FrameBuffer/UnoAppWinUILinuxValidation.Skia.Linux.FrameBuffer.csproj", ""),
@(0, "UnoAppWinUILinuxValidation/UnoAppWinUILinuxValidation.Wasm/UnoAppWinUILinuxValidation.Wasm.csproj", @(), @()),
@(0, "UnoAppWinUILinuxValidation/UnoAppWinUILinuxValidation.Skia.Gtk/UnoAppWinUILinuxValidation.Skia.Gtk.csproj", @(), @()),
@(0, "UnoAppWinUILinuxValidation/UnoAppWinUILinuxValidation.Skia.Linux.FrameBuffer/UnoAppWinUILinuxValidation.Skia.Linux.FrameBuffer.csproj", @(), @()),

# 5.1 Blank
@(0, "5.1/uno51blank/uno51blank.Skia.Gtk/uno51blank.Skia.Gtk.csproj", ""),
@(0, "5.1/uno51blank/uno51blank.Skia.Linux.FrameBuffer/uno51blank.Skia.Linux.FrameBuffer.csproj", ""),
@(0, "5.1/uno51blank/uno51blank.Skia.WPF/uno51blank.Skia.WPF.csproj", ""),
@(0, "5.1/uno51blank/uno51blank.Wasm/uno51blank.Wasm.csproj", ""),
@(0, "5.1/uno51blank/uno51blank.Skia.Gtk/uno51blank.Skia.Gtk.csproj", @(), @()),
@(0, "5.1/uno51blank/uno51blank.Skia.Linux.FrameBuffer/uno51blank.Skia.Linux.FrameBuffer.csproj", @(), @()),
@(0, "5.1/uno51blank/uno51blank.Skia.WPF/uno51blank.Skia.WPF.csproj", @(), @()),
@(0, "5.1/uno51blank/uno51blank.Wasm/uno51blank.Wasm.csproj", @(), @()),

# 5.1 Recommended
@(0, "5.1/uno51recommended/uno51recommended.Skia.Gtk/uno51recommended.Skia.Gtk.csproj", ""),
@(0, "5.1/uno51recommended/uno51recommended.Skia.Linux.FrameBuffer/uno51recommended.Skia.Linux.FrameBuffer.csproj", ""),
@(0, "5.1/uno51recommended/uno51recommended.Skia.WPF/uno51recommended.Skia.WPF.csproj", ""),
@(0, "5.1/uno51recommended/uno51recommended.Wasm/uno51recommended.Wasm.csproj", ""),
@(0, "5.1/uno51recommended/uno51recommended.Server/uno51recommended.Server.csproj", ""),
@(0, "5.1/uno51recommended/uno51recommended.Tests/uno51recommended.Tests.csproj", ""),
@(0, "5.1/uno51recommended/uno51recommended.UITests/uno51recommended.UITests.csproj", ""),
@(0, "5.1/uno51recommended/uno51recommended.Skia.Gtk/uno51recommended.Skia.Gtk.csproj", @(), @()),
@(0, "5.1/uno51recommended/uno51recommended.Skia.Linux.FrameBuffer/uno51recommended.Skia.Linux.FrameBuffer.csproj", @(), @()),
@(0, "5.1/uno51recommended/uno51recommended.Skia.WPF/uno51recommended.Skia.WPF.csproj", @(), @()),
@(0, "5.1/uno51recommended/uno51recommended.Wasm/uno51recommended.Wasm.csproj", @(), @()),
@(0, "5.1/uno51recommended/uno51recommended.Server/uno51recommended.Server.csproj", @(), @()),
@(0, "5.1/uno51recommended/uno51recommended.Tests/uno51recommended.Tests.csproj", @(), @()),
@(0, "5.1/uno51recommended/uno51recommended.UITests/uno51recommended.UITests.csproj", @(), @()),

# 5.2 Blank
@(1, "5.2/uno52blank/uno52blank/uno52blank.csproj", ""),
@(1, "5.2/uno52blank/uno52blank/uno52blank.csproj", @(), @()),

# 5.2 Blank SkiaSharp 3
@(1, "5.2/uno52blank/uno52blank/uno52blank.csproj", "-p:SkiaSharpVersion=3.0.0-preview.3.1"),
@(1, "5.2/uno52blank/uno52blank/uno52blank.csproj", @("-p:SkiaSharpVersion=3.0.0-preview.3.1"), @()),

# 5.2 Blank GLCanvas
@(1, "5.2/uno52blank/uno52blank/uno52blank.csproj", "-p:UnoFeatures=GLCanvas"),
@(1, "5.2/uno52blank/uno52blank/uno52blank.csproj", @("-p:UnoFeatures=GLCanvas"), @()),

# 5.2 Uno Lib
@(1, "5.2/uno52Lib/uno52Lib.csproj", ""),
@(1, "5.2/uno52Lib/uno52Lib.csproj", @(), @()),

# 5.2 Uno NuGet Lib
@(1, "5.2/uno52NuGetLib/uno52NuGetLib.csproj", ""),
@(1, "5.2/uno52NuGetLib/uno52NuGetLib.csproj", @(), @()),

# 5.2 Uno SingleProject Lib
@(1, "5.2/uno52SingleProjectLib/uno52SingleProjectLib.csproj", ""),
@(1, "5.2/uno52SingleProjectLib/uno52SingleProjectLib.csproj", @(), @()),

# 5.2 Uno App with Library reference
@(1, "5.2/uno52AppWithLib/uno52AppWithLib/uno52AppWithLib.csproj", ""),
@(1, "5.2/uno52AppWithLib/uno52AppWithLib/uno52AppWithLib.csproj", @(), @()),

# 5.3 Blank with net9
@(2, "5.3/uno53net9blank/uno53net9blank/uno53net9blank.csproj", "")
@(2, "5.3/uno53net9blank/uno53net9blank/uno53net9blank.csproj", @(), @())

# 5.3 blank publish testing
# Disabled for LXD setup issues
# @(2, "5.3/uno53net9blank/uno53net9blank/uno53net9blank.csproj", @("-f:net9.0-desktop", "-p:SelfContained=true", "-p:PackageFormat=snap"), @("Publish"))

## Note for contributors
##
Expand All @@ -90,22 +94,30 @@ for($i = 0; $i -lt $projects.Length; $i++)
{
$projectTestGroup=$projects[$i][0];
$projectPath=$projects[$i][1];
$projectOptions=$projects[$i][2];
$projectParameters=$projects[$i][2];

$buildOptions=$projects[$i][3];
$usePublish = $buildOptions -contains "Publish"

if ($TestGroup -ne $projectTestGroup)
{
Write-Host "Skipping test $projectPath for group $projectTestGroup"
continue
}

Write-Host "Building Debug $projectPath with $projectOptions"
dotnet build $debug "$projectPath" $projectOptions -bl:binlogs/$projectPath/debug.binlog
Assert-ExitCodeIsZero
if(!$usePublish)
{
Write-Host "Building Debug $projectPath with $projectParameters"
dotnet build $debug "$projectPath" $projectParameters -bl:binlogs/$projectPath/$i/debug.binlog
Assert-ExitCodeIsZero

dotnet clean $debug "$projectPath"
}

dotnet clean $debug "$projectPath"
$dotnetCommand = $usePublish ? "publish" : "build"

Write-Host "Building Release $projectPath with $projectOptions"
dotnet build $release "$projectPath" $projectOptions -bl:binlogs/$projectPath/release.binlog
Write-Host "Building Release $projectPath with $projectParameters"
dotnet $dotnetCommand $release "$projectPath" $projectParameters -bl:binlogs/$projectPath/$i/release.binlog
Assert-ExitCodeIsZero

dotnet clean $release "$projectPath"
Expand Down
Loading

0 comments on commit ddbdbbb

Please sign in to comment.