Skip to content
Merged

CI #108

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/actions/install-mono/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: 'Install Mono'
description: 'Install Mono'
branding:
icon: package
color: blue
inputs:
arch:
description: Architecture to install for
required: true
runs:
using: "composite"
steps:
# Windows Cache
- name: Cache setup on Windows
if: runner.os == 'Windows'
run: |
mkdir -p .choco-cache
choco config set cacheLocation $(pwd)/.choco-cache
shell: bash

- name: Cache on Windows
if: runner.os == 'Windows'
uses: actions/cache@v5
with:
path: .choco-cache
key: mono-${{ runner.os }}-${{ inputs.arch }}

# macOS Cache
- name: Set Homebrew Cache Path
if: runner.os == 'macOS'
run: |
mkdir -p .brew-cache
echo "HOMEBREW_CACHE=$(pwd)/.brew-cache" >> $GITHUB_ENV
shell: bash

- name: Cache Homebrew on macOS
if: runner.os == 'macOS'
uses: actions/cache@v5
with:
path: .brew-cache
key: mono-brew-${{ runner.os }}-${{ inputs.arch }}

# ===================================

- name: Install on Linux
if: runner.os == 'Linux'
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: mono-runtime-sgen

# ===================================

- name: Install on Windows (x86)
if: runner.os == 'Windows' && inputs.arch == 'x86'
run: choco install --x86 -y mono
shell: sh

- name: Install on Windows
if: runner.os == 'Windows' && inputs.arch != 'x86'
run: choco install -y mono
shell: sh

# ===================================
#
- name: Install on macOS (x86_64)
if: runner.os == 'macOS' && inputs.arch == 'x64'
run: |
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
arch -x86_64 /usr/local/bin/brew install --ignore-dependencies mono
shell: sh

- name: Install on macOS (arm64)
if: runner.os == 'macOS' && inputs.arch != 'x64'
run: |
brew update
brew install --ignore-dependencies mono
shell: sh

97 changes: 67 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,53 +38,90 @@ jobs:
run: ruff check

test:
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os.instance }}
needs: build
strategy:
fail-fast: false
matrix:
# macos-13-arm64, windows-11-arm
# TODO:
# - Install mono via install-package action
# - Update macos images to at least 14 as 13 is retired
# - Update ubuntu images
os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest, macos-13]
python: ['3.14', '3.13', '3.12', '3.11', '3.10'] # pypy3
os:
- category: windows
platform: x64
instance: windows-latest
suffix: -windows-x86_64-none

- category: windows
platform: x86
instance: windows-latest
suffix: -windows-x86-none

- category: ubuntu
platform: x64
instance: ubuntu-22.04
suffix: ""

- category: ubuntu
platform: arm64
instance: ubuntu-22.04-arm
suffix: ""

- category: macos
platform: x64
instance: macos-15
suffix: -macos-x86_64-none

- category: macos
platform: arm64
instance: macos-15
suffix: -macos-aarch64-none

python: ['3.14', '3.13', '3.12', '3.11', '3.10']

exclude:
# Broken ctypes find_library
- os:
category: macos
platform: arm64
python: '3.10'
- os:
category: macos
platform: arm64
python: '3.11'
- os:
category: macos
platform: arm64
python: '3.12'

# Fails to call mono methods
- os:
category: windows
platform: x86
python: '3.13'

steps:
- name: Set Environment on macOS
uses: maxim-lobanov/setup-xamarin@v1
if: ${{ matrix.os.category == 'macos' }}
- uses: actions/checkout@v6

- name: Install Mono
uses: ./.github/actions/install-mono
with:
mono-version: latest
arch: ${{ matrix.os.platform }}

- name: Setup .NET
uses: actions/setup-dotnet@v5
# use most current version until architecture: support is released
uses: actions/setup-dotnet@main
with:
dotnet-version: '10.0'
architecture: ${{ matrix.os.platform }}

- name: Set up Python ${{ matrix.python }}
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python }}

- name: Cache Mono
if: runner.os == 'Windows'
uses: actions/cache@v5
with:
path: ${{ env.TEMP }}\chocolatey
key: ${{ runner.os }}-chocolatey-${{ matrix.python == 'pypy3' && '32' || '64' }}

- name: Install Mono
if: runner.os == 'Windows'
run: |
choco install -y mono ${{ matrix.python == 'pypy3' && '--x86' || '' }}
- uses: actions/checkout@v6
python-version: cpython-${{ matrix.python }}${{ matrix.os.suffix }}
cache-python: true
activate-environment: true
enable-cache: true

- name: Install dependencies
run: |
uv venv
uv pip install pytest
- name: Download wheel
Expand All @@ -100,7 +137,7 @@ jobs:
- name: Test with pytest
run: |
uv run pytest
pytest
deploy:
runs-on: ubuntu-latest
Expand Down
Loading