diff --git a/.github/actions/install-mono/action.yml b/.github/actions/install-mono/action.yml new file mode 100644 index 000000000..7f0a1f775 --- /dev/null +++ b/.github/actions/install-mono/action.yml @@ -0,0 +1,43 @@ +name: 'Install Mono' +description: 'Install Mono' +branding: + icon: package + color: blue +inputs: + arch: + description: Architecture to install for + required: true +runs: + using: "composite" + steps: + - 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 mono + shell: sh + + - name: Install on macOS + if: runner.os == 'macOS' && inputs.arch != 'x64' + run: | + brew update + brew install mono + shell: sh + + - name: Install on Linux + if: runner.os == 'Linux' + run: | + sudo apt update + sudo apt install -y mono-runtime-sgen + shell: sh + + - 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 + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 53c0934ae..79399fa78 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,36 +17,42 @@ jobs: matrix: os: # Disabled for now, will require some work (#2653) + # The main issue is setup-dotnet stubbornly installing for x64 only # # - category: windows # platform: x86 # instance: windows-latest + # suffix: -windows-x86-none - category: windows platform: x64 instance: windows-latest + suffix: -windows-x86_64-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-13 + instance: macos-15 + suffix: -macos-x86_64-none - python: ["3.10", "3.11", "3.12", "3.13"] + - category: macos + platform: arm64 + instance: macos-15 + suffix: -macos-aarch64-none + python: ["3.10", "3.11", "3.12", "3.13"] + env: + NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages steps: - - name: Set Environment on macOS - uses: maxim-lobanov/setup-xamarin@v1 - if: ${{ matrix.os.category == 'macos' }} - with: - mono-version: latest - - name: Checkout code uses: actions/checkout@v6 @@ -55,33 +61,41 @@ jobs: with: dotnet-version: '8.0.x' + - name: Install Mono + uses: ./.github/actions/install-mono + with: + arch: ${{ matrix.os.platform }} + + - name: Setup upterm session + uses: owenthereal/action-upterm@v1 + if: ${{ failure() }} + with: + ## Shut down the server if unconnected after 5 minutes. + limit-access-to-actor: true + wait-timeout-minutes: 5 + - name: Set up Python ${{ matrix.python }} uses: astral-sh/setup-uv@v7 with: - architecture: ${{ matrix.os.platform }} - python-version: ${{ matrix.python }} + python-version: cpython-${{ matrix.python }}${{ matrix.os.suffix }} cache-python: true activate-environment: true enable-cache: true + - run: dotnet restore + - name: Synchronize the virtual environment run: uv sync --managed-python - - name: Show pyvenv.cfg - run: cat .venv/pyvenv.cfg - - name: Embedding tests (Mono/.NET Framework) run: dotnet test --runtime any-${{ matrix.os.platform }} --framework net472 --logger "console;verbosity=detailed" src/embed_tests/ - if: always() env: MONO_THREADS_SUSPEND: preemptive # https://github.com/mono/mono/issues/21466 - name: Embedding tests (.NET Core) run: dotnet test --runtime any-${{ matrix.os.platform }} --framework net8.0 --logger "console;verbosity=detailed" src/embed_tests/ - if: always() - name: Python Tests (Mono) - if: ${{ matrix.os.category != 'windows' }} run: pytest --runtime mono - name: Python Tests (.NET Core)