Skip to content

Commit 5c32dab

Browse files
committed
[ECO-4285] Updated github workflows to only support packaging nuget
1 parent 98933e3 commit 5c32dab

14 files changed

Lines changed: 144 additions & 45 deletions

File tree

.github/workflows/features.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# WORKFLOW DISABLED - Set if: false on all jobs
12
name: Features
23

34
on:
@@ -8,6 +9,7 @@ on:
89

910
jobs:
1011
build:
12+
if: false # Workflow disabled
1113
uses: ably/features/.github/workflows/sdk-features.yml@main
1214
with:
1315
repository-name: ably-dotnet

.github/workflows/package.yml

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# ============================================================================
2+
# ACTIVE PACKAGING WORKFLOW - Uses Cake Build System
3+
# ============================================================================
4+
# This is the primary workflow for creating NuGet packages and Unity packages.
5+
# It replaces the legacy FAKE build system scripts (package.sh, package-push.sh).
6+
#
7+
# To create a release:
8+
# 1. Go to Actions tab → Package ably workflow
9+
# 2. Click "Run workflow" and enter the version number (e.g., 1.2.3)
10+
# 3. Download artifacts: output-package, output-package-push, output-package-unity
11+
# ============================================================================
12+
113
name: Package ably
214
on:
315
workflow_dispatch:
@@ -8,7 +20,7 @@ on:
820

921
jobs:
1022
package-library:
11-
runs-on: windows-latest
23+
runs-on: windows-2022
1224
steps:
1325
- uses: actions/checkout@v4
1426
with:
@@ -22,8 +34,29 @@ jobs:
2234
6.0.403
2335
7.0.408
2436
37+
- name: Setup Android SDK
38+
uses: android-actions/setup-android@v3
39+
40+
- name: Install Android SDK Platform 30
41+
shell: pwsh
42+
run: |
43+
echo "y" | & "$env:ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager.bat" "platforms;android-30"
44+
echo "y" | & "$env:ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager.bat" "build-tools;30.0.3"
45+
46+
- name: Install legacy Xamarin
47+
shell: pwsh
48+
run: |
49+
# Install Xamarin.Android and Xamarin.iOS components via VS installer
50+
# windows-latest has VS 2022 which needs explicit Xamarin installation
51+
Write-Host "Installing Xamarin workload for VS 2022..."
52+
& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" modify `
53+
--installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" `
54+
--add Microsoft.VisualStudio.Workload.XamarinBuildTools `
55+
--add Component.Xamarin `
56+
--quiet --wait
57+
2558
- name: Download cake tool
26-
run: dotnet tool restore
59+
run: dotnet tool restore
2760

2861
- name: Package
2962
run: ./package-cake.cmd ${{ github.event.inputs.version }}
@@ -36,7 +69,7 @@ jobs:
3669
${{ github.workspace }}/*.nupkg
3770
3871
package-push:
39-
runs-on: macos-latest
72+
runs-on: macos-12
4073
env:
4174
DOTNET_NOLOGO: true
4275

@@ -45,6 +78,19 @@ jobs:
4578
with:
4679
submodules: 'recursive'
4780

81+
- name: Setup Xcode
82+
uses: maxim-lobanov/setup-xcode@v1
83+
with:
84+
xcode-version: '14.3'
85+
86+
- name: Setup Android SDK
87+
uses: android-actions/setup-android@v3
88+
89+
- name: Install Android SDK Platform 30
90+
run: |
91+
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "platforms;android-30"
92+
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "build-tools;30.0.3"
93+
4894
- name: Download dotnet framework
4995
uses: actions/setup-dotnet@v3
5096
with:
@@ -53,13 +99,27 @@ jobs:
5399
6.0.403
54100
7.0.408
55101
102+
- name: Install Xamarin (legacy)
103+
run: |
104+
# macOS 13 runners should have Xamarin pre-installed
105+
# Verify Xamarin.iOS and Xamarin.Android are available
106+
ls -la "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/" || true
107+
ls -la "/Library/Frameworks/Xamarin.iOS.framework/" || true
108+
109+
# If not found, install via brew
110+
if [ ! -d "/Library/Frameworks/Xamarin.iOS.framework/" ]; then
111+
echo "Installing Xamarin via brew..."
112+
brew install --cask xamarin-ios || true
113+
brew install --cask xamarin-android || true
114+
fi
115+
56116
- name: Download cake tool
57-
run: dotnet tool restore
117+
run: dotnet tool restore
58118

59-
- name: Package
119+
- name: Package Push (iOS & Android)
60120
run: ./package-push-cake.sh ${{ github.event.inputs.version }}
61121

62-
- name: Archive package
122+
- name: Archive push packages
63123
uses: actions/upload-artifact@v4
64124
with:
65125
name: output-package
@@ -86,7 +146,7 @@ jobs:
86146
- name: Package Unity
87147
run: ./package-unity-cake.sh ${{ github.event.inputs.version }}
88148

89-
- name: Archive package
149+
- name: Archive Unity package
90150
uses: actions/upload-artifact@v4
91151
with:
92152
name: output-package

.github/workflows/run-tests-linux.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# WORKFLOW DISABLED - Set if: false on all jobs
12
name: "Unit and Integration Test: Linux"
23
on:
34
pull_request:
@@ -7,6 +8,7 @@ on:
78

89
jobs:
910
check:
11+
if: false # Workflow disabled
1012
runs-on: ubuntu-latest
1113
env:
1214
DOTNET_NOLOGO: true

.github/workflows/run-tests-macos-mono.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# WORKFLOW DISABLED - Set if: false on all jobs
12
name: "Unit and Integration Test: macOS (Mono)"
23
on:
34
pull_request:
@@ -7,6 +8,7 @@ on:
78

89
jobs:
910
check:
11+
if: false # Workflow disabled
1012
runs-on: macos-latest
1113
env:
1214
DOTNET_NOLOGO: true

.github/workflows/run-tests-macos.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# WORKFLOW DISABLED - Set if: false on all jobs
12
name: "Unit and Integration Test: macOS"
23
on:
34
pull_request:
@@ -7,6 +8,7 @@ on:
78

89
jobs:
910
check:
11+
if: false # Workflow disabled
1012
runs-on: macos-latest
1113
env:
1214
DOTNET_NOLOGO: true

.github/workflows/run-tests-windows-netframework.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# WORKFLOW DISABLED - Set if: false on all jobs
12
name: "Unit and Integration Test: Windows (NetFramework)"
23
on:
34
pull_request:
@@ -7,6 +8,7 @@ on:
78

89
jobs:
910
check:
11+
if: false # Workflow disabled
1012
runs-on: windows-latest
1113
env:
1214
DOTNET_NOLOGO: true

.github/workflows/run-tests-windows.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# WORKFLOW DISABLED - Set if: false on all jobs
12
name: "Unit and Integration Test: Windows"
23
on:
34
pull_request:
@@ -7,6 +8,7 @@ on:
78

89
jobs:
910
check:
11+
if: false # Workflow disabled
1012
runs-on: windows-latest
1113
env:
1214
DOTNET_NOLOGO: true

cake-build/helpers/paths.cake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class BuildPaths
1111
public DirectoryPath Package { get; }
1212
public DirectoryPath Lib { get; }
1313

14+
public FilePath MainSolution { get; }
1415
public FilePath NetStandardSolution { get; }
1516
public FilePath NetFrameworkSolution { get; }
1617
public FilePath XamarinSolution { get; }
@@ -30,6 +31,7 @@ public class BuildPaths
3031
TestResults = BuildOutput.Combine("tests");
3132
Package = BuildOutput.Combine("package");
3233

34+
MainSolution = Src.CombineWithFilePath("IO.Ably.sln");
3335
NetStandardSolution = Src.CombineWithFilePath("IO.Ably.NetStandard.sln");
3436
NetFrameworkSolution = Src.CombineWithFilePath("IO.Ably.NetFramework.sln");
3537
XamarinSolution = Src.CombineWithFilePath("IO.Ably.Xamarin.sln");

cake-build/tasks/build.cake

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,46 @@ Task("Clean")
1212
EnsureDirectoryExists(paths.Package);
1313
});
1414

15-
Task("Restore")
16-
.Does(() =>
15+
// Helper method to restore a solution (matches FAKE behavior)
16+
void RestoreSolution(FilePath solutionPath)
1717
{
18-
Information("Restoring NuGet packages...");
19-
20-
// FAKE restores the main IO.Ably.sln solution, not IO.Ably.NetStandard.sln
21-
var mainSolution = paths.Src.CombineWithFilePath("IO.Ably.sln");
18+
Information($"Restoring NuGet packages for {solutionPath.GetFilename()}...");
2219

23-
// Use NuGet CLI for .NET Framework projects (packages.config)
24-
// This is critical for both Windows and macOS/Linux with Mono
25-
Information("Running NuGet restore...");
20+
// Step 1: NuGet restore (Windows only, for packages.config)
2621
try
2722
{
28-
if (IsRunningOnWindows())
29-
{
30-
NuGetRestore(mainSolution.FullPath);
31-
}
32-
else
33-
{
34-
// On macOS/Linux, use nuget command (installed via mono)
35-
StartProcess("nuget", new ProcessSettings
36-
{
37-
Arguments = $"restore {mainSolution.FullPath}"
38-
});
39-
}
23+
Information("Running NuGet restore...");
24+
NuGetRestore(solutionPath.FullPath);
25+
Information($"✓ NuGet restore completed");
4026
}
4127
catch (Exception ex)
4228
{
4329
Warning($"NuGet restore failed: {ex.Message}");
44-
// Continue anyway as dotnet restore might handle it
30+
// Step 2: dotnet restore (all platforms, for SDK-style projects)
31+
try
32+
{
33+
Information("Running dotnet restore...");
34+
var restoreSettings = new DotNetRestoreSettings
35+
{
36+
MSBuildSettings = new DotNetMSBuildSettings()
37+
.WithProperty("WarningsNotAsErrors", "NU1903;NU1503")
38+
.WithProperty("NoWarn", "NU1903;NU1503")
39+
};
40+
DotNetRestore(solutionPath.FullPath, restoreSettings);
41+
Information($"✓ dotnet restore completed");
42+
}
43+
catch (Exception e)
44+
{
45+
Warning($"dotnet restore failed: {e.Message}");
46+
}
4547
}
46-
47-
Information("Running dotnet restore...");
48-
// Suppress NU1903 vulnerability warning for Newtonsoft.Json 9.0.1 (known issue, accepted risk)
49-
var restoreSettings = new DotNetRestoreSettings
50-
{
51-
MSBuildSettings = new DotNetMSBuildSettings()
52-
.WithProperty("WarningsNotAsErrors", "NU1903")
53-
.WithProperty("NoWarn", "NU1903")
54-
};
55-
DotNetRestore(mainSolution.FullPath, restoreSettings);
48+
}
49+
50+
Task("Restore")
51+
.Does(() =>
52+
{
53+
// FAKE restores the main IO.Ably.sln solution, not IO.Ably.NetStandard.sln
54+
RestoreSolution(paths.MainSolution);
5655
});
5756

5857
Task("Version")

cake-build/tasks/package.cake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
///////////////////////////////////////////////////////////////////////////////
44

55
Task("Package-Build-All")
6-
.IsDependentOn("Prepare")
6+
.IsDependentOn("Clean")
77
.IsDependentOn("Version")
88
.Does(() =>
99
{
@@ -15,6 +15,9 @@ Task("Package-Build-All")
1515
return;
1616
}
1717

18+
// Restore the package solution (not the main solution)
19+
RestoreSolution(paths.PackageSolution);
20+
1821
var settings = buildConfig.ApplyStandardSettings(
1922
new MSBuildSettings(),
2023
"Release"
@@ -107,7 +110,7 @@ Task("Package-Create-NuGet")
107110
});
108111

109112
Task("PushPackage-Build-All")
110-
.IsDependentOn("Prepare")
113+
.IsDependentOn("Clean")
111114
.IsDependentOn("Version")
112115
.Does(() =>
113116
{
@@ -119,6 +122,9 @@ Task("PushPackage-Build-All")
119122
return;
120123
}
121124

125+
// Restore the push package solution (not the main solution)
126+
RestoreSolution(paths.PushPackageSolution);
127+
122128
var settings = buildConfig.ApplyStandardSettings(
123129
new MSBuildSettings(),
124130
"Package"

0 commit comments

Comments
 (0)