Run Tests #3830
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run Tests | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| schedule: | |
| - cron: '0, 0,12 * * *' | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| formatting: | |
| name: Check Formatting | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| - name: Install Formatting | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ruff flake8 | |
| - name: Check Formatting | |
| run: | | |
| ruff check . | |
| flake8 . | |
| typos: | |
| name: Typos | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: typos-action | |
| uses: crate-ci/[email protected] | |
| documents: | |
| name: Build Sphinx Documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --no-cache-dir .\[all\] | |
| - name: Build Sphinx Documentation (HTML) | |
| working-directory: ./docs/source | |
| run: | | |
| mkdir -p _build/doctrees | |
| sphinx-build -T -W --keep-going -b html -d _build/doctrees -D language=en . _build/html | |
| - name: Install LaTeX dependencies | |
| run: | | |
| sudo apt-get update -qq -y | |
| sudo apt-get install -qq -y texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended latexmk | |
| - name: Build Sphinx Documentation (PDF) | |
| working-directory: ./docs | |
| run: | | |
| make latexpdf | |
| requirements-formatting: | |
| name: Check Requirements Formatting | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check Formatting | |
| run: | | |
| sort -C requirements.txt | |
| tests-3x: | |
| name: Run Unit Tests (Python 3.x) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - python-version: 3.8.16 | |
| os: ubuntu-latest | |
| numpy-version: "1.21.0" | |
| scipy-version: "1.6.3" | |
| remove-setuptools: false | |
| - python-version: 3.8.16 | |
| os: ubuntu-latest | |
| numpy-version: "1.21.0" | |
| scipy-version: "latest" | |
| remove-setuptools: false | |
| - python-version: 3.8.16 | |
| os: ubuntu-latest | |
| numpy-version: "latest" | |
| scipy-version: "1.6.3" | |
| remove-setuptools: false | |
| - python-version: 3.8.16 | |
| os: ubuntu-latest | |
| numpy-version: "latest" | |
| scipy-version: "latest" | |
| remove-setuptools: false | |
| - python-version: 3.10.10 | |
| os: ubuntu-latest | |
| numpy-version: "1.23.5" | |
| scipy-version: "1.8.0" | |
| remove-setuptools: false | |
| - python-version: 3.10.10 | |
| os: ubuntu-latest | |
| numpy-version: "1.21.5" | |
| scipy-version: "latest" | |
| remove-setuptools: false | |
| - python-version: 3.10.10 | |
| os: ubuntu-latest | |
| numpy-version: "latest" | |
| scipy-version: "1.8.0" | |
| remove-setuptools: false | |
| - python-version: 3.10.10 | |
| os: ubuntu-latest | |
| numpy-version: "latest" | |
| scipy-version: "latest" | |
| remove-setuptools: false | |
| - python-version: 3.12.3 | |
| os: ubuntu-latest | |
| numpy-version: "1.26.4" | |
| scipy-version: "1.11.4" | |
| remove-setuptools: false | |
| - python-version: 3.12.3 | |
| os: ubuntu-latest | |
| numpy-version: "1.26.4" | |
| scipy-version: "latest" | |
| remove-setuptools: false | |
| - python-version: 3.12.3 | |
| os: ubuntu-latest | |
| numpy-version: "latest" | |
| scipy-version: "1.11.4" | |
| remove-setuptools: false | |
| - python-version: 3.12.3 | |
| os: ubuntu-latest | |
| numpy-version: "latest" | |
| scipy-version: "latest" | |
| remove-setuptools: false | |
| - python-version: 3.12.3 | |
| os: ubuntu-latest | |
| numpy-version: "latest" | |
| scipy-version: "latest" | |
| remove-setuptools: true # <- this one uses the latest setuptools | |
| - python-version: 3.13 | |
| os: ubuntu-latest | |
| numpy-version: "latest" | |
| scipy-version: "latest" | |
| remove-setuptools: false | |
| - python-version: 3.13 | |
| os: ubuntu-latest | |
| numpy-version: "latest" | |
| scipy-version: "latest" | |
| remove-setuptools: true # <- this one uses the latest setuptools | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Wait for apt-get lock | |
| run: | | |
| while sudo fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1; do | |
| echo "Waiting for apt lock release..." | |
| sleep 1 | |
| done | |
| - name: Install APT On Linux | |
| run: | | |
| sudo apt-get update -qq -y | |
| sudo apt-get install -qq -y libspatialindex-dev freeglut3-dev libsuitesparse-dev libblas-dev liblapack-dev | |
| sudo apt-get install -qq -y xvfb # for headless testing | |
| - name: Install Blender | |
| run: | | |
| sudo apt-get install -qq -y wget | |
| BLENDER_VERSION="4.2.0" | |
| BLENDER_URL="https://download.blender.org/release/Blender4.2/blender-${BLENDER_VERSION}-linux-x64.tar.xz" | |
| wget -q ${BLENDER_URL} -O /tmp/blender.tar.xz | |
| sudo tar -xf /tmp/blender.tar.xz -C /opt | |
| sudo ln -s /opt/blender-${BLENDER_VERSION}-linux-x64/blender /usr/local/bin/blender | |
| blender --version | |
| - name: Install Pytestp | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| pip install Cython | |
| pip install pytest ruff | |
| - name: Install scikit-robot | |
| run: | | |
| pip cache purge | |
| pip install --no-cache-dir .\[all\] | |
| - name: Install NumPy and SciPy | |
| run: | | |
| if [ "${{ matrix.numpy-version }}" = "latest" ]; then | |
| pip install numpy -U | |
| else | |
| pip install numpy==${{ matrix.numpy-version }} | |
| fi | |
| if [ "${{ matrix.scipy-version }}" = "latest" ]; then | |
| pip install scipy -U | |
| else | |
| pip install scipy==${{ matrix.scipy-version }} | |
| fi | |
| - name: Remove setuptools | |
| run: | | |
| # Simulate 3.12> + venv where setuptools is not pre-installed by default. | |
| if [ "${{ matrix.remove-setuptools }}" = "true" ]; then | |
| pip uninstall -y setuptools | |
| else | |
| echo "setuptools is not removed" | |
| fi | |
| - name: Run Pytest | |
| # Normally, users would run `pytest -v tests`, but this test uses xvfb to test the GUI scripts in the examples/ directory. | |
| run: | | |
| for i in {1..3}; do | |
| if xvfb-run pytest -v tests; then | |
| echo "Tests passed on attempt $i" | |
| break | |
| else | |
| echo "Tests failed on attempt $i" | |
| if [ "$i" -eq 3 ]; then | |
| echo "All retry attempts failed" | |
| exit 1 | |
| fi | |
| echo "Retrying in 10 seconds..." | |
| sleep 10 | |
| fi | |
| done | |