Skip to content

Safer & stronger-typed API for buffers #1933

Safer & stronger-typed API for buffers

Safer & stronger-typed API for buffers #1933

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET CI
on:
push:
branches: ["main"]
paths:
- ".github/workflows/dotnet-ci.yml"
- "src/**"
- "templates/**"
- "samples/**"
pull_request:
branches: ["main"]
paths:
- ".github/workflows/dotnet-ci.yml"
- "src/**"
- "templates/**"
- "samples/**"
permissions:
contents: read
jobs:
validate-python:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
fail-fast: false
steps:
- uses: actions/checkout@v5
with:
submodules: 'true'
- name: Setup Python
id: installpython
uses: actions/setup-python@v6
with:
python-version: "${{ matrix.python }}"
- name: Run pyright on test Python code
run: |
python -m pip install pyright attrs
python -m pip install -r src/Integration.Tests/python/requirements.txt
pyright --pythonversion ${{ matrix.python }} src/*.Tests/**/*.py
unit-test:
permissions:
contents: read
actions: write # For actions/cache
strategy:
matrix:
os: [windows-latest, windows-11-arm, ubuntu-latest, macos-latest, ubuntu-24.04-arm]
fail-fast: true
runs-on: "${{ matrix.os }}"
steps:
- uses: actions/checkout@v5
with:
submodules: 'true'
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
- uses: actions/cache@v5
name: Cache NuGet packages
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore -bl:${{ github.workspace }}/restore-${{ matrix.os }}-${{ matrix.python }}.binlog
working-directory: src
env:
PYTHON_VERSION: ${{ matrix.python }}
- name: Build
run: dotnet build --no-restore -bl:${{ github.workspace }}/build-${{ matrix.os }}-${{ matrix.python }}.binlog
working-directory: src
- name: Test CSnakes.Tests
run: dotnet test --no-build --blame --verbosity m --logger "console;verbosity=detailed" --collect "XPlat Code Coverage" --results-directory test-results /p:TrxLogFileNameSuffix=${{ matrix.os }}-${{ matrix.python }} -bl:${{ github.workspace }}/tests-${{ matrix.os }}-${{ matrix.python }}.binlog CSnakes.Tests
working-directory: src
- name: Test CSnakes.Runtime.Tests
run: dotnet test --no-build --blame --verbosity m --logger "console;verbosity=detailed" --collect "XPlat Code Coverage" --results-directory test-results /p:TrxLogFileNameSuffix=${{ matrix.os }}-${{ matrix.python }} -bl:${{ github.workspace }}/tests-${{ matrix.os }}-${{ matrix.python }}.binlog CSnakes.Runtime.Tests
working-directory: src
- name: Test StdLib.Tests
run: dotnet test --no-build --blame --verbosity m --logger "console;verbosity=detailed" --collect "XPlat Code Coverage" --results-directory test-results /p:TrxLogFileNameSuffix=${{ matrix.os }}-${{ matrix.python }} -bl:${{ github.workspace }}/tests-${{ matrix.os }}-${{ matrix.python }}.binlog StdLib.Tests
working-directory: src
integration-test:
permissions:
contents: read
actions: write # For actions/cache and upload-artifact
needs: unit-test
strategy:
matrix:
os: [windows-latest, windows-11-arm, ubuntu-latest, macos-latest, ubuntu-24.04-arm]
python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
exclude:
# WoA doesn't support Python 3.9 and 3.10 according to the redistributable locator
- os: windows-11-arm
python: "3.9"
- os: windows-11-arm
python: "3.10"
fail-fast: false
runs-on: "${{ matrix.os }}"
steps:
- uses: actions/checkout@v5
with:
submodules: 'true'
- uses: conda-incubator/setup-miniconda@v3.1.0
id: setup-conda
if: matrix.os != 'windows-11-arm'
with:
auto-update-conda: true
python-version: "${{ matrix.python }}"
channels: conda-forge, conda-forge/label/python_rc
activate-environment: csnakes_test
environment-file: src/Conda.Tests/python/environment.yml
- name: cleanup conda-incubator/setup-miniconda
if: matrix.os != 'windows-11-arm'
run: conda clean --all --yes
- name: check conda export
if: matrix.os != 'windows-11-arm'
run: |
conda env export --name csnakes_test
conda info
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
- uses: actions/cache@v5
name: Cache NuGet packages
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore -bl:${{ github.workspace }}/restore-${{ matrix.os }}-${{ matrix.python }}.binlog
working-directory: src
env:
PYTHON_VERSION: ${{ matrix.python }}
- name: Build
run: dotnet build --no-restore -bl:${{ github.workspace }}/build-${{ matrix.os }}-${{ matrix.python }}.binlog
working-directory: src
- name: Prime Python environment
run: ./src/Integration.Tests/python/install.ps1 -PythonVersion ${{ matrix.python }} -NoBuild -Verbose
shell: pwsh
- name: Integration Tests
run: dotnet test --no-build --blame --verbosity m --logger "console;verbosity=detailed" --collect "XPlat Code Coverage" --results-directory test-results /p:TrxLogFileNameSuffix=${{ matrix.os }}-${{ matrix.python }} -bl:${{ github.workspace }}/tests-${{ matrix.os }}-${{ matrix.python }}.binlog Integration.Tests ${{ matrix.os != 'windows-11-arm' && '--filter "FullyQualifiedName!~WindowsArm64Tests"' || '' }}
working-directory: src
env:
PYTHON_VERSION: ${{ matrix.python }}
UV_NO_CACHE: 1
- name: Prime Python environment (Free Threaded)
run: ./src/Integration.Tests/python/install.ps1 -PythonVersion ${{ matrix.python }} -FreeThreaded -NoBuild -Verbose
if: startsWith(matrix.python, '3.13') || startsWith(matrix.python, '3.14')
shell: pwsh
- name: Integration Tests (Free Threaded)
run: dotnet test --no-build --blame --verbosity m --logger "console;verbosity=detailed" --collect "XPlat Code Coverage" --results-directory test-results /p:TrxLogFileNameSuffix=${{ matrix.os }}-${{ matrix.python }} -bl:${{ github.workspace }}/tests-${{ matrix.os }}-${{ matrix.python }}.binlog Integration.Tests ${{ matrix.os != 'windows-11-arm' && '--filter "FullyQualifiedName!~WindowsArm64Tests"' || '' }}
if: startsWith(matrix.python, '3.13') || startsWith(matrix.python, '3.14')
working-directory: src
env:
PYTHON_VERSION: ${{ matrix.python }}
UV_NO_CACHE: 1
PYTHON_FREETHREADED: 1
- name: Test Conda
if: matrix.os != 'windows-11-arm'
run: dotnet test --no-build --blame --verbosity m --logger "console;verbosity=detailed" --collect "XPlat Code Coverage" --results-directory test-results /p:TrxLogFileNameSuffix=${{ matrix.os }}-${{ matrix.python }} -bl:${{ github.workspace }}/tests-${{ matrix.os }}-${{ matrix.python }}.binlog Conda.Tests
working-directory: src
env:
PYTHON_VERSION: ${{ matrix.python }}
UV_NO_CACHE: 1
- name: Test UV/Redist
run: dotnet test --no-build --blame --verbosity m --logger "console;verbosity=detailed" --collect "XPlat Code Coverage" --results-directory test-results /p:TrxLogFileNameSuffix=${{ matrix.os }}-${{ matrix.python }} -bl:${{ github.workspace }}/tests-${{ matrix.os }}-${{ matrix.python }}.binlog RedistributablePython.Tests
working-directory: src
env:
PYTHON_VERSION: ${{ matrix.python }}
UV_NO_CACHE: 1
- name: Upload logs
uses: actions/upload-artifact@v6
if: always()
with:
name: logs-${{ matrix.os }}-${{ matrix.python }}
path: |
${{ github.workspace }}/*.binlog
- name: Upload test results
uses: actions/upload-artifact@v6
if: always()
with:
name: test-results-${{ matrix.os }}-${{ matrix.python }}
path: |
${{ github.workspace }}/src/test-results/**
build-samples:
needs: unit-test
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python: ["3.12"]
sample: ["simple", "Aspire"]
fail-fast: false
runs-on: "${{ matrix.os }}"
steps:
- uses: actions/checkout@v5
with:
submodules: 'true'
- name: Setup Python
id: installpython
uses: actions/setup-python@v6
with:
python-version: "${{ matrix.python }}"
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
- name: Install Aspire workload
run: dotnet workload install aspire
- name: Restore dependencies
run: dotnet restore "${{ matrix.sample }}"
working-directory: samples
- name: Build
run: dotnet build --no-restore "${{ matrix.sample }}"
working-directory: samples
- name: Test
run: dotnet test --no-build --verbosity normal "${{ matrix.sample }}"
working-directory: samples
env:
PYTHON_VERSION: ${{ steps.installpython.outputs.python-version }}