Skip to content

Commit fb65b13

Browse files
committed
Install Mono
1 parent e0897bd commit fb65b13

2 files changed

Lines changed: 107 additions & 19 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: 'Install Mono'
2+
description: 'Install Mono'
3+
branding:
4+
icon: package
5+
color: blue
6+
inputs:
7+
arch:
8+
description: Architecture to install for
9+
required: true
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Cache on Linux
14+
if: runner.os == 'Linux'
15+
uses: actions/cache@v5
16+
with:
17+
path: .apt
18+
key: mono-${{ runner.os }}-${{ inputs.arch }}
19+
20+
- name: Cache on Windows
21+
if: runner.os == 'Windows'
22+
uses: actions/cache@v5
23+
with:
24+
path: ${{ env.TEMP }}\chocolatey
25+
key: mono-${{ runner.os }}-${{ inputs.arch }}
26+
27+
# - name: Cache on macOS (x86_64)
28+
# if: runner.os == 'Linux'
29+
# uses: actions/cache@v5
30+
# with:
31+
# path: .apt
32+
# key: mono-${{ runner.os }}-${{ inputs.arch }}
33+
#
34+
# - name: Cache on macOS (arm64)
35+
# if: runner.os == 'Linux'
36+
# uses: actions/cache@v5
37+
# with:
38+
# path: .apt
39+
# key: mono-${{ runner.os }}-${{ inputs.arch }}
40+
41+
# ===================================
42+
43+
- name: Install on Linux
44+
if: runner.os == 'Linux'
45+
run: |
46+
sudo apt-get -o Dir::Cache=".apt" update
47+
sudo apt-get -o Dir::Cache=".apt" install -y mono-runtime-sgen
48+
shell: sh
49+
50+
- name: Install on Windows (x86)
51+
if: runner.os == 'Windows' && inputs.arch == 'x86'
52+
run: choco install --x86 -y mono
53+
shell: sh
54+
55+
- name: Install on Windows
56+
if: runner.os == 'Windows' && inputs.arch != 'x86'
57+
run: choco install -y mono
58+
shell: sh
59+
60+
- name: Install on macOS (x86_64)
61+
if: runner.os == 'macOS' && inputs.arch == 'x64'
62+
run: |
63+
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
64+
arch -x86_64 /usr/local/bin/brew install mono
65+
shell: sh
66+
67+
- name: Install on macOS (arm64)
68+
if: runner.os == 'macOS' && inputs.arch != 'x64'
69+
run: |
70+
brew update
71+
brew install mono
72+
shell: sh
73+

.github/workflows/ci.yml

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
run: ruff check
3939

4040
test:
41-
runs-on: ${{ matrix.os }}
41+
runs-on: ${{ matrix.os.instance }}
4242
needs: build
4343
strategy:
4444
fail-fast: false
@@ -48,15 +48,39 @@ jobs:
4848
# - Install mono via install-package action
4949
# - Update macos images to at least 14 as 13 is retired
5050
# - Update ubuntu images
51-
os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest, macos-13]
51+
os:
52+
- category: windows
53+
platform: x64
54+
instance: windows-latest
55+
suffix: -windows-x86_64-none
56+
57+
- category: ubuntu
58+
platform: x64
59+
instance: ubuntu-22.04
60+
suffix: ""
61+
62+
- category: ubuntu
63+
platform: arm64
64+
instance: ubuntu-22.04-arm
65+
suffix: ""
66+
67+
- category: macos
68+
platform: x64
69+
instance: macos-15
70+
suffix: -macos-x86_64-none
71+
72+
- category: macos
73+
platform: arm64
74+
instance: macos-15
75+
suffix: -macos-aarch64-none
76+
5277
python: ['3.14', '3.13', '3.12', '3.11', '3.10'] # pypy3
5378

5479
steps:
55-
- name: Set Environment on macOS
56-
uses: maxim-lobanov/setup-xamarin@v1
57-
if: ${{ matrix.os.category == 'macos' }}
80+
- name: Install Mono
81+
uses: ./.github/actions/install-mono
5882
with:
59-
mono-version: latest
83+
arch: ${{ matrix.os.platform }}
6084

6185
- name: Setup .NET
6286
uses: actions/setup-dotnet@v5
@@ -66,19 +90,10 @@ jobs:
6690
- name: Set up Python ${{ matrix.python }}
6791
uses: astral-sh/setup-uv@v7
6892
with:
69-
python-version: ${{ matrix.python }}
70-
71-
- name: Cache Mono
72-
if: runner.os == 'Windows'
73-
uses: actions/cache@v5
74-
with:
75-
path: ${{ env.TEMP }}\chocolatey
76-
key: ${{ runner.os }}-chocolatey-${{ matrix.python == 'pypy3' && '32' || '64' }}
77-
78-
- name: Install Mono
79-
if: runner.os == 'Windows'
80-
run: |
81-
choco install -y mono ${{ matrix.python == 'pypy3' && '--x86' || '' }}
93+
python-version: cpython-${{ matrix.python }}${{ matrix.os.suffix }}
94+
cache-python: true
95+
activate-environment: true
96+
enable-cache: true
8297

8398
- uses: actions/checkout@v6
8499

0 commit comments

Comments
 (0)