| name: tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11"] | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-py${{ matrix.python-version }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Build smoke fixtures | |
| run: | | |
| python tests/fixtures/build_smoke_data.py | |
| - name: Run tests | |
| run: | | |
| python -m pytest tests/ -v --tb=short | |
| - name: Test imports of all modules | |
| run: | | |
| python -c "from caff.trainer import CAFFTrainer; print('trainer OK')" | |
| python -c "from caff.data import KnowledgeGraph, CAFFTripleDataset; print('data OK')" | |
| python -c "from caff.model import CAFFModel; print('model OK')" | |
| python -c "from caff.evaluator import CAFFEvaluator; print('evaluator OK')" | |
| python -c "from caff.config import CAFFConfig, AblationFlags; print('config OK')" | |