Skip to content

Commit 08d27aa

Browse files
committed
- Fixed devcontainer.json to load windows system with necessary dependencies
- Updated github workflows with specific ubuntu, macOS and windows versions
1 parent 647b624 commit 08d27aa

File tree

9 files changed

+132
-35
lines changed

9 files changed

+132
-35
lines changed

.devcontainer/devcontainer.json

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,46 @@
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": {
5+
"submodules": "git submodule update --init --recursive",
6+
"install-dependencies": "bash .devcontainer/install-dependencies.sh"
7+
},
8+
"postCreateCommand": "dotnet tool restore",
9+
"customizations": {
10+
"vscode": {
11+
"extensions": [
12+
"ms-dotnettools.csdevkit"
13+
],
14+
"settings": {
15+
"dotnet.server.useOmnisharp": false,
16+
"files.watcherExclude": {
17+
"**/bin/**": true,
18+
"**/obj/**": true,
19+
"**/.git/**": true,
20+
"**/node_modules/**": true,
21+
"**/.vs/**": true
22+
},
23+
"search.exclude": {
24+
"**/bin": true,
25+
"**/obj": true,
26+
"**/node_modules": true
27+
},
28+
"files.eol": "\n"
29+
}
1430
}
1531
},
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"
32+
"containerEnv": {
33+
"DOTNET_CLI_TELEMETRY_OPTOUT": "1",
34+
"DOTNET_SKIP_FIRST_TIME_EXPERIENCE": "1",
35+
"DOTNET_NOLOGO": "1",
36+
"NUGET_XMLDOC_MODE": "skip",
37+
"DOTNET_CLI_UI_LANGUAGE": "en",
38+
"NUGET_PACKAGES": "${containerWorkspaceFolder}/.nuget/packages"
39+
},
40+
"remoteEnv": {
41+
"PATH": "${containerEnv:PATH}:${containerWorkspaceFolder}/.dotnet/tools"
42+
},
43+
"mounts": [
44+
"source=ably-dotnet-nuget-cache,target=${containerWorkspaceFolder}/.nuget/packages,type=volume"
45+
]
3246
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
# Add Mono repository (using official method for Debian 10+)
22+
echo "🔑 Adding Mono repository..."
23+
sudo gpg --homedir /tmp --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
24+
sudo chmod +r /usr/share/keyrings/mono-official-archive-keyring.gpg
25+
echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/debian stable-buster main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
26+
echo "✓ Mono repository added"
27+
echo ""
28+
29+
# Add Microsoft package repository for .NET runtimes
30+
echo "🔑 Adding Microsoft package repository..."
31+
wget -q https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
32+
sudo dpkg -i packages-microsoft-prod.deb
33+
rm packages-microsoft-prod.deb
34+
echo "✓ Microsoft repository added"
35+
echo ""
36+
37+
# Update package lists again
38+
echo "📦 Updating package lists with new repositories..."
39+
sudo apt-get update -qq
40+
echo "✓ Package lists updated"
41+
echo ""
42+
43+
# Install Mono and NuGet
44+
echo "🔧 Installing Mono and NuGet (this may take a few minutes)..."
45+
sudo apt-get install -y mono-complete nuget
46+
echo "✓ Mono and NuGet installed"
47+
echo ""
48+
49+
# Install .NET 6.0 runtime
50+
echo "🔧 Installing .NET 6.0 runtime..."
51+
sudo apt-get install -y dotnet-runtime-6.0
52+
echo "✓ .NET 6.0 runtime installed"
53+
echo ""
54+
55+
# Install .NET 7.0 runtime
56+
echo "🔧 Installing .NET 7.0 runtime..."
57+
sudo apt-get install -y dotnet-runtime-7.0
58+
echo "✓ .NET 7.0 runtime installed"
59+
echo ""
60+
61+
echo "=========================================="
62+
echo "✅ All dependencies installed successfully!"
63+
echo "=========================================="
64+
echo ""
65+
66+
echo "📋 Installed versions:"
67+
echo ""
68+
echo "Mono version:"
69+
mono --version | head -n 1
70+
echo ""
71+
echo ".NET Runtimes:"
72+
dotnet --list-runtimes
73+
echo ""
74+
echo ".NET SDKs:"
75+
dotnet --list-sdks
76+
echo ""
77+
echo "NuGet version:"
78+
nuget help | head -n 1
79+
echo ""
80+
echo "=========================================="
81+
echo "🎉 Setup complete! You can now build the project."
82+
echo "=========================================="

.github/workflows/package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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:
@@ -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: 1 addition & 1 deletion
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

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

Lines changed: 1 addition & 1 deletion
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

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

Lines changed: 1 addition & 1 deletion
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

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

Lines changed: 1 addition & 1 deletion
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

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

Lines changed: 1 addition & 1 deletion
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

.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

0 commit comments

Comments
 (0)