Skip to content

Dev

Dev #25

Workflow file for this run

# CI - runs on PRs to releases branch
# Separated jobs for faster feedback and clearer results
name: CI
on:
pull_request:
branches: [releases]
env:
# Shared pip cache key prefix
PIP_CACHE_KEY: pip-v1
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-paths: pyproject.toml
- name: Install linting tools
run: pip install black flake8
- name: Check formatting with black
run: black --check --diff microfinity/ meshcutter/ tests/
- name: Lint with flake8
run: flake8 microfinity/ meshcutter/ tests/ --max-line-length=120 --extend-ignore=E203,W503,F401,F403,F405,E402,F821,W293,W605,F841
test-microfinity:
name: Test microfinity (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-paths: pyproject.toml
- name: Install dependencies
run: |
pip install --upgrade pip
pip install cadquery-ocp cadquery cqkit
pip install pytest
pip install -e .
- name: Run microfinity tests
run: pytest microfinity/tests/ tests/ -v
test-meshcutter-unit:
name: Test meshcutter unit (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-paths: pyproject.toml
- name: Install dependencies
run: |
pip install --upgrade pip
pip install cadquery-ocp cadquery cqkit
pip install manifold3d
pip install pytest
pip install -e .
- name: Run meshcutter unit tests
run: pytest meshcutter/tests/ -m "not integration" -v
test-meshcutter-integration:
name: Test meshcutter integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-paths: pyproject.toml
- name: Install dependencies
run: |
pip install --upgrade pip
pip install cadquery-ocp cadquery cqkit
pip install manifold3d
pip install pytest
pip install -e .
- name: Create artifact directory
run: mkdir -p test-artifacts
- name: Run meshcutter integration tests
id: integration-tests
run: |
pytest meshcutter/tests/ -m "integration" -v \
--tb=short \
--basetemp=test-artifacts/tmp
continue-on-error: true
- name: Collect test artifacts on failure
if: steps.integration-tests.outcome == 'failure'
run: |
# Collect any STL files generated during tests
find test-artifacts -name "*.stl" -o -name "*.3mf" 2>/dev/null | head -20 || true
# Also check /tmp for any test outputs
find /tmp -maxdepth 2 -name "*.stl" -newer /tmp -mmin -5 2>/dev/null | head -10 || true
- name: Upload test artifacts
if: steps.integration-tests.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: failed-test-artifacts
path: |
test-artifacts/
/tmp/*.stl
if-no-files-found: ignore
retention-days: 7
- name: Fail if tests failed
if: steps.integration-tests.outcome == 'failure'
run: exit 1
build:
name: Build Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-paths: pyproject.toml
- name: Install build tools
run: pip install build twine
- name: Build package
run: python -m build
- name: Check package
run: twine check dist/*
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/