Skip to content

bump: version 1.0.1 → 1.1.0 #20

bump: version 1.0.1 → 1.1.0

bump: version 1.0.1 → 1.1.0 #20

Workflow file for this run

name: Tests
on:
push:
branches: [ main, dev/jmlr, feature/gpu_fix ]
pull_request:
branches: [ main, dev/jmlr, feature/gpu_fix ]
workflow_call:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest] # macos doesn't work with CUDA
python-version: ["3.9", "3.10", "3.11"]
pytorch-version: ["2.7.0+cu126"]
exclude:
# Exclude some combinations to reduce CI load: macos doesn't work with CUDA, and ubuntu 3.9 triggers Codecov not available
# - os: ubuntu-latest
# python-version: "3.9"
- os: macos-latest
python-version: "3.9"
- os: macos-latest
python-version: "3.10"
- os: macos-latest
python-version: "3.11"
steps:
- uses: actions/checkout@v4
# with:
# fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Install PyTorch ${{ matrix.pytorch-version }}
run: |
python -m pip install --upgrade pip
pip install torch==${{ matrix.pytorch-version }} --index-url https://download.pytorch.org/whl/cu126
# pip install torch==${{ matrix.pytorch-version }} --index-url https://download.pytorch.org/whl/cpu
- name: Install package, dev, and test dependencies
run: pip install -e ".[dev, tests]"
- name: Run unit and gpu tests with coverage
# Automatically uses pytest configuration from pyproject.toml
run: pytest
env:
PYTORCH_VERSION: ${{ matrix.pytorch-version }}
# run: |
# pytest tests/unit/ -v \
# --cov=torchsom \
# --cov-report=xml \
# --cov-report=html \
# --cov-report=term-missing \
# --cov-config=pyproject.toml \
# --junit-xml=junit.xml \
# --timeout=300 \
# -n auto \
# -m "unit or gpu"
- name: Analyze code with SonarQube
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' && matrix.pytorch-version == '2.7.0+cu126'
uses: SonarSource/sonarqube-scan-action@v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# with:
# token: ${{ env.SONAR_TOKEN }}
# organization: michelin
# projectKey: michelin_TorchSOM
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.os }}-py${{ matrix.python-version }}-torch${{ matrix.pytorch-version }}
path: |
coverage.xml
htmlcov/
junit.xml
# test-gpu:
# runs-on: self-hosted
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# strategy:
# fail-fast: false
# matrix:
# python-version: ["3.10"]
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install CUDA PyTorch
# run: |
# python -m pip install --upgrade pip
# pip install torch --index-url https://download.pytorch.org/whl/cu118
# - name: Install package, dev, and test dependencies
# run: pip install -e ".[dev, tests]"
# - name: Run GPU tests
# run: |
# pytest tests/unit/ -v \
# --cov=torchsom \
# --cov-report=xml \
# --cov-report=term-missing \
# --junit-xml=junit-gpu.xml \
# --timeout=600 \
# -m "gpu"
# env:
# CUDA_VISIBLE_DEVICES: 0
# - name: Upload GPU test results
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: gpu-test-results
# path: |
# coverage.xml
# junit-gpu.xml
# integration-tests:
# runs-on: ubuntu-latest
# needs: test
# if: false
# # github.event_name == 'push'
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python 3.10
# uses: actions/setup-python@v4
# with:
# python-version: "3.10"
# - name: Install package, dev, and test dependencies
# run: pip install -e ".[dev, tests]"
# - name: Run integration tests
# run: |
# pytest tests/ -v \
# --cov=torchsom \
# --cov-report=xml \
# --cov-report=term-missing \
# --junit-xml=junit-integration.xml \
# --timeout=600 \
# -m "integration"
# continue-on-error: true
# - name: Upload integration test results
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: integration-test-results
# path: |
# coverage.xml
# junit-integration.xml