Skip to content

Commit 905b19f

Browse files
authored
Merge pull request #1308 from ably/fix/github-workflow
Refactor build scripts and github workflow
2 parents 861c001 + 665a657 commit 905b19f

24 files changed

+294
-278
lines changed

.devcontainer/devcontainer.json

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2-
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
31
{
4-
"name": "C# (.NET)",
5-
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
"image": "mcr.microsoft.com/devcontainers/dotnet:0-6.0",
7-
"features": {
8-
"ghcr.io/devcontainers/features/dotnet:1": {
9-
"installUsingApt": true,
10-
"version": "6.0"
11-
},
12-
"ghcr.io/devcontainers/features/ruby:1": {
13-
"version": "3.1"
2+
"name": "C# (.NET) - Linux with Mono",
3+
"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm",
4+
"onCreateCommand": "git submodule update --init --recursive",
5+
"postAttachCommand": "bash .devcontainer/install-dependencies.sh",
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"ms-dotnettools.csdevkit"
10+
],
11+
"settings": {
12+
"dotnet.server.useOmnisharp": false,
13+
"files.watcherExclude": {
14+
"**/bin/**": true,
15+
"**/obj/**": true,
16+
"**/.git/**": true,
17+
"**/node_modules/**": true,
18+
"**/.vs/**": true
19+
},
20+
"search.exclude": {
21+
"**/bin": true,
22+
"**/obj": true,
23+
"**/node_modules": true
24+
},
25+
"files.eol": "\n"
26+
}
1427
}
1528
},
16-
// Features to add to the dev container. More info: https://containers.dev/features.
17-
// "features": {},
18-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
19-
// "forwardPorts": [5000, 5001],
20-
// "portsAttributes": {
21-
// "5001": {
22-
// "protocol": "https"
23-
// }
24-
// }
25-
// Use 'postCreateCommand' to run commands after the container is created.
26-
// Used for downloading all submodules and restoring dotnet tools as a part of dotnet CLI
27-
"postCreateCommand": "git submodule init && git submodule update && dotnet tool restore"
28-
// Configure tool-specific properties.
29-
// "customizations": {},
30-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
31-
// "remoteUser": "root"
29+
"containerEnv": {
30+
"DOTNET_CLI_TELEMETRY_OPTOUT": "1",
31+
"DOTNET_SKIP_FIRST_TIME_EXPERIENCE": "1",
32+
"DOTNET_NOLOGO": "1",
33+
"NUGET_XMLDOC_MODE": "skip",
34+
"DOTNET_CLI_UI_LANGUAGE": "en",
35+
"NUGET_PACKAGES": "${containerWorkspaceFolder}/.nuget/packages"
36+
},
37+
"remoteEnv": {
38+
"PATH": "${containerEnv:PATH}:${containerWorkspaceFolder}/.dotnet/tools"
39+
},
40+
"mounts": [
41+
"source=ably-dotnet-nuget-cache,target=${containerWorkspaceFolder}/.nuget/packages,type=volume"
42+
]
3243
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "=========================================="
5+
echo "Installing dependencies for Ably .NET development..."
6+
echo "=========================================="
7+
echo ""
8+
9+
# Update package lists
10+
echo "📦 Updating package lists..."
11+
sudo apt-get update -qq
12+
echo "✓ Package lists updated"
13+
echo ""
14+
15+
# Install prerequisites
16+
echo "📦 Installing prerequisites (gnupg, ca-certificates, wget)..."
17+
sudo apt-get install -y gnupg ca-certificates wget
18+
echo "✓ Prerequisites installed"
19+
echo ""
20+
21+
# Note: Installing Mono from Debian's official repositories
22+
echo "ℹ️ Using Mono from Debian official repositories (bookworm)"
23+
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
24+
echo "deb https://download.mono-project.com/repo/debian stable-buster main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
25+
echo ""
26+
27+
# Add Microsoft package repository for .NET runtimes
28+
echo "🔑 Adding Microsoft package repository..."
29+
wget -q https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
30+
sudo dpkg -i packages-microsoft-prod.deb
31+
rm packages-microsoft-prod.deb
32+
echo "✓ Microsoft repository added"
33+
echo ""
34+
35+
# Update package lists with Microsoft repository
36+
echo "📦 Updating package lists..."
37+
sudo apt-get update -qq
38+
echo "✓ Package lists updated"
39+
echo ""
40+
41+
# Install Mono and NuGet
42+
echo "🔧 Installing Mono and NuGet (this may take a few minutes)..."
43+
sudo apt-get install -y mono-complete nuget
44+
echo "✓ Mono and NuGet installed"
45+
echo ""
46+
47+
# Install .NET 6.0 runtime
48+
echo "🔧 Installing .NET 6.0 runtime..."
49+
sudo apt-get install -y dotnet-runtime-6.0
50+
echo "✓ .NET 6.0 runtime installed"
51+
echo ""
52+
53+
# Install .NET 7.0 runtime
54+
echo "🔧 Installing .NET 7.0 runtime..."
55+
sudo apt-get install -y dotnet-runtime-7.0
56+
echo "✓ .NET 7.0 runtime installed"
57+
echo ""
58+
59+
echo "=========================================="
60+
echo "✅ All dependencies installed successfully!"
61+
echo "=========================================="
62+
echo ""
63+
64+
echo "📋 Installed versions:"
65+
echo ""
66+
echo "Mono version:"
67+
mono --version | head -n 1
68+
echo ""
69+
echo ".NET Runtimes:"
70+
dotnet --list-runtimes
71+
echo ""
72+
echo ".NET SDKs:"
73+
dotnet --list-sdks
74+
echo ""
75+
echo "NuGet version:"
76+
nuget help | head -n 1
77+
echo ""
78+
echo "=========================================="
79+
echo "🎉 Setup complete! You can now build the project."
80+
echo "=========================================="

.github/workflows/package.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
dotnet-version: |
3535
3.1.426
3636
6.0.428
37-
7.0.
37+
7.0.410
3838
3939
- name: Setup Android SDK
4040
uses: android-actions/setup-android@v3
@@ -79,7 +79,7 @@ jobs:
7979
run: dotnet tool restore
8080

8181
- name: Package
82-
run: ./package-cake.cmd ${{ github.event.inputs.version }}
82+
run: ./package.cmd ${{ github.event.inputs.version }}
8383

8484
- name: Archive package
8585
uses: actions/upload-artifact@v4
@@ -137,7 +137,7 @@ jobs:
137137
run: dotnet tool restore
138138

139139
- name: Package Push (iOS & Android)
140-
run: ./package-push-cake.sh ${{ github.event.inputs.version }}
140+
run: ./package-push.sh ${{ github.event.inputs.version }}
141141

142142
- name: Archive push packages
143143
uses: actions/upload-artifact@v4
@@ -147,7 +147,7 @@ jobs:
147147
${{ github.workspace }}/*.nupkg
148148
149149
package-unity:
150-
runs-on: ubuntu-latest
150+
runs-on: ubuntu-22.04
151151
steps:
152152
- uses: actions/checkout@v4
153153
with:
@@ -164,7 +164,7 @@ jobs:
164164
run: dotnet tool restore
165165

166166
- name: Package Unity
167-
run: ./package-unity-cake.sh ${{ github.event.inputs.version }}
167+
run: ./package-unity.sh ${{ github.event.inputs.version }}
168168

169169
- name: Archive Unity package
170170
uses: actions/upload-artifact@v4
@@ -174,7 +174,7 @@ jobs:
174174
${{ github.workspace }}/*.unitypackage
175175
176176
merge-artifacts:
177-
runs-on: ubuntu-latest
177+
runs-on: ubuntu-22.04
178178
needs: [package-library, package-push, package-unity]
179179
steps:
180180
- name: Download all artifacts

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
check:
10-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-22.04
1111
env:
1212
DOTNET_NOLOGO: true
1313

@@ -34,7 +34,7 @@ jobs:
3434
run: dotnet tool restore
3535

3636
- name: Unit tests
37-
run: ./build-cake.sh --target=Test.NetStandard.Unit.WithRetry --framework=${{ matrix.targetframework }}
37+
run: ./build.sh --target=Test.NetStandard.Unit.WithRetry --framework=${{ matrix.targetframework }}
3838

3939
- name: Integration tests
40-
run: ./build-cake.sh --target=Test.NetStandard.Integration.WithRetry --framework=${{ matrix.targetframework }}
40+
run: ./build.sh --target=Test.NetStandard.Integration.WithRetry --framework=${{ matrix.targetframework }}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
check:
10-
runs-on: macos-latest
10+
runs-on: macos-13
1111
env:
1212
DOTNET_NOLOGO: true
1313

@@ -20,8 +20,8 @@ jobs:
2020
uses: actions/setup-dotnet@v4
2121
with:
2222
dotnet-version: |
23-
3.1.x
24-
7.0.408
23+
3.1.426
24+
7.0.410
2525
2626
- name: Download dotnet build-script tools
2727
run: dotnet tool restore
@@ -31,7 +31,7 @@ jobs:
3131
./tools/mono-install.sh
3232
3333
- name: Run Unit tests using mono
34-
run: ./build-cake.sh --target=Test.NetFramework.Unit.WithRetry
34+
run: ./build.sh --target=Test.NetFramework.Unit.WithRetry
3535

3636
- name: Run Integration tests using mono
37-
run: ./build-cake.sh --target=Test.NetFramework.Integration.WithRetry
37+
run: ./build.sh --target=Test.NetFramework.Integration.WithRetry

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
check:
10-
runs-on: macos-latest
10+
runs-on: macos-13
1111
env:
1212
DOTNET_NOLOGO: true
1313

@@ -34,7 +34,7 @@ jobs:
3434
run: dotnet tool restore
3535

3636
- name: Unit tests
37-
run: ./build-cake.sh --target=Test.NetStandard.Unit.WithRetry --framework=${{ matrix.targetframework }}
37+
run: ./build.sh --target=Test.NetStandard.Unit.WithRetry --framework=${{ matrix.targetframework }}
3838

3939
- name: Integration tests
40-
run: ./build-cake.sh --target=Test.NetStandard.Integration.WithRetry --framework=${{ matrix.targetframework }}
40+
run: ./build.sh --target=Test.NetStandard.Integration.WithRetry --framework=${{ matrix.targetframework }}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
check:
10-
runs-on: windows-latest
10+
runs-on: windows-2022
1111
env:
1212
DOTNET_NOLOGO: true
1313

@@ -20,13 +20,13 @@ jobs:
2020
uses: actions/setup-dotnet@v4
2121
with:
2222
dotnet-version: |
23-
7.0.408
23+
7.0.410
2424
2525
- name: Download dotnet build-script tools
2626
run: dotnet tool restore
2727

2828
- name: Unit tests
29-
run: ./build-cake.cmd --target=Test.NetFramework.Unit.WithRetry
29+
run: ./build.cmd --target=Test.NetFramework.Unit.WithRetry
3030

3131
- name: Integration tests
32-
run: ./build-cake.cmd --target=Test.NetFramework.Integration.WithRetry
32+
run: ./build.cmd --target=Test.NetFramework.Integration.WithRetry

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
check:
10-
runs-on: windows-latest
10+
runs-on: windows-2022
1111
env:
1212
DOTNET_NOLOGO: true
1313

@@ -34,7 +34,7 @@ jobs:
3434
run: dotnet tool restore
3535

3636
- name: Unit tests
37-
run: ./build-cake.cmd --target=Test.NetStandard.Unit.WithRetry --framework=${{ matrix.targetframework }}
37+
run: ./build.cmd --target=Test.NetStandard.Unit.WithRetry --framework=${{ matrix.targetframework }}
3838

3939
- name: Integration tests
40-
run: ./build-cake.cmd --target=Test.NetStandard.Integration.WithRetry --framework=${{ matrix.targetframework }}
40+
run: ./build.cmd --target=Test.NetStandard.Integration.WithRetry --framework=${{ matrix.targetframework }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ publish/
110110
*.nupkg
111111
# The packages folder can be ignored because of Package Restore
112112
packages/
113+
.nuget/
113114
# except build/, which is used as an MSBuild target.
114115
!packages/build/
115116
# Uncomment if necessary however generally it will be regenerated when needed
File renamed without changes.

0 commit comments

Comments
 (0)