Skip to content

Commit 89640da

Browse files
authored
CI (#108)
1 parent e0897bd commit 89640da

File tree

2 files changed

+145
-30
lines changed

2 files changed

+145
-30
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
# Windows Cache
14+
- name: Cache setup on Windows
15+
if: runner.os == 'Windows'
16+
run: |
17+
mkdir -p .choco-cache
18+
choco config set cacheLocation $(pwd)/.choco-cache
19+
shell: bash
20+
21+
- name: Cache on Windows
22+
if: runner.os == 'Windows'
23+
uses: actions/cache@v5
24+
with:
25+
path: .choco-cache
26+
key: mono-${{ runner.os }}-${{ inputs.arch }}
27+
28+
# macOS Cache
29+
- name: Set Homebrew Cache Path
30+
if: runner.os == 'macOS'
31+
run: |
32+
mkdir -p .brew-cache
33+
echo "HOMEBREW_CACHE=$(pwd)/.brew-cache" >> $GITHUB_ENV
34+
shell: bash
35+
36+
- name: Cache Homebrew on macOS
37+
if: runner.os == 'macOS'
38+
uses: actions/cache@v5
39+
with:
40+
path: .brew-cache
41+
key: mono-brew-${{ runner.os }}-${{ inputs.arch }}
42+
43+
# ===================================
44+
45+
- name: Install on Linux
46+
if: runner.os == 'Linux'
47+
uses: awalsh128/cache-apt-pkgs-action@v1
48+
with:
49+
packages: mono-runtime-sgen
50+
51+
# ===================================
52+
53+
- name: Install on Windows (x86)
54+
if: runner.os == 'Windows' && inputs.arch == 'x86'
55+
run: choco install --x86 -y mono
56+
shell: sh
57+
58+
- name: Install on Windows
59+
if: runner.os == 'Windows' && inputs.arch != 'x86'
60+
run: choco install -y mono
61+
shell: sh
62+
63+
# ===================================
64+
#
65+
- name: Install on macOS (x86_64)
66+
if: runner.os == 'macOS' && inputs.arch == 'x64'
67+
run: |
68+
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
69+
arch -x86_64 /usr/local/bin/brew install --ignore-dependencies mono
70+
shell: sh
71+
72+
- name: Install on macOS (arm64)
73+
if: runner.os == 'macOS' && inputs.arch != 'x64'
74+
run: |
75+
brew update
76+
brew install --ignore-dependencies mono
77+
shell: sh
78+

.github/workflows/ci.yml

Lines changed: 67 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -38,53 +38,90 @@ 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
4545
matrix:
46-
# macos-13-arm64, windows-11-arm
47-
# TODO:
48-
# - Install mono via install-package action
49-
# - Update macos images to at least 14 as 13 is retired
50-
# - Update ubuntu images
51-
os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest, macos-13]
52-
python: ['3.14', '3.13', '3.12', '3.11', '3.10'] # pypy3
46+
os:
47+
- category: windows
48+
platform: x64
49+
instance: windows-latest
50+
suffix: -windows-x86_64-none
51+
52+
- category: windows
53+
platform: x86
54+
instance: windows-latest
55+
suffix: -windows-x86-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+
77+
python: ['3.14', '3.13', '3.12', '3.11', '3.10']
78+
79+
exclude:
80+
# Broken ctypes find_library
81+
- os:
82+
category: macos
83+
platform: arm64
84+
python: '3.10'
85+
- os:
86+
category: macos
87+
platform: arm64
88+
python: '3.11'
89+
- os:
90+
category: macos
91+
platform: arm64
92+
python: '3.12'
93+
94+
# Fails to call mono methods
95+
- os:
96+
category: windows
97+
platform: x86
98+
python: '3.13'
5399

54100
steps:
55-
- name: Set Environment on macOS
56-
uses: maxim-lobanov/setup-xamarin@v1
57-
if: ${{ matrix.os.category == 'macos' }}
101+
- uses: actions/checkout@v6
102+
103+
- name: Install Mono
104+
uses: ./.github/actions/install-mono
58105
with:
59-
mono-version: latest
106+
arch: ${{ matrix.os.platform }}
60107

61108
- name: Setup .NET
62-
uses: actions/setup-dotnet@v5
109+
# use most current version until architecture: support is released
110+
uses: actions/setup-dotnet@main
63111
with:
64112
dotnet-version: '10.0'
113+
architecture: ${{ matrix.os.platform }}
65114

66115
- name: Set up Python ${{ matrix.python }}
67116
uses: astral-sh/setup-uv@v7
68117
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' || '' }}
82-
83-
- uses: actions/checkout@v6
118+
python-version: cpython-${{ matrix.python }}${{ matrix.os.suffix }}
119+
cache-python: true
120+
activate-environment: true
121+
enable-cache: true
84122

85123
- name: Install dependencies
86124
run: |
87-
uv venv
88125
uv pip install pytest
89126
90127
- name: Download wheel
@@ -100,7 +137,7 @@ jobs:
100137
101138
- name: Test with pytest
102139
run: |
103-
uv run pytest
140+
pytest
104141
105142
deploy:
106143
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)