Run apt-get update in CI before installing graphviz (#150)
#724
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: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| test-core: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| name: test-core (Python ${{ matrix.python-version }}) | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| mamba-version: "*" | |
| channels: conda-forge,defaults | |
| channel-priority: true | |
| python-version: ${{ matrix.python-version }} | |
| environment-file: environment.yml | |
| - name: Install syntheseus | |
| run: | | |
| pip install .[dev] | |
| - name: Run pre-commit | |
| run: | | |
| pre-commit run --verbose --all-files | |
| - name: Run unit tests | |
| run: | | |
| coverage run -p -m pytest ./syntheseus/tests/ | |
| coverage report --data-file .coverage.* | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: .coverage.core-${{ matrix.python-version }} | |
| path: .coverage.* | |
| include-hidden-files: true | |
| test-models: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| runner: ["ubuntu-latest", "Syntheseus-GPU"] | |
| runs-on: ${{ matrix.runner }} | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| name: test-models (${{ matrix.runner == 'ubuntu-latest' && 'CPU' || 'GPU' }}) | |
| steps: | |
| - name: Free extra disk space | |
| uses: jlumbroso/free-disk-space@main | |
| - uses: actions/checkout@v3 | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| mamba-version: "*" | |
| channels: conda-forge,defaults | |
| channel-priority: true | |
| environment-file: environment_full.yml | |
| - name: Install syntheseus with all single-step models | |
| run: | | |
| sudo apt-get update | |
| sudo apt install -y graphviz | |
| pip install .[all] | |
| - name: Verify GPU is available | |
| if: ${{ matrix.runner != 'ubuntu-latest' }} | |
| run: | | |
| nvidia-smi || (echo "❌ No GPU detected" && exit 1) | |
| python -c "import torch; assert torch.cuda.is_available(), '❌ GPU not found'; print('✅ Found GPU:', torch.cuda.get_device_name(0))" | |
| - name: Run single-step model tests | |
| run: | | |
| coverage run -p -m pytest \ | |
| ./syntheseus/tests/cli/test_cli.py \ | |
| ./syntheseus/tests/reaction_prediction/inference/test_models.py \ | |
| ./syntheseus/tests/reaction_prediction/utils/test_parallel.py | |
| coverage report --data-file .coverage.* | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: .coverage.models-${{ matrix.runner }} | |
| path: .coverage.* | |
| include-hidden-files: true | |
| coverage: | |
| needs: [test-core, test-models] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.9 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install coverage | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Generate a combined coverage report | |
| run: | | |
| coverage combine | |
| coverage report |