Merge pull request #19 from lamalab-org/tests #63
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, refactor_namer] | |
| pull_request: | |
| branches: ["**"] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install ruff | |
| run: pip install "ruff==0.15.15" | |
| - name: Ruff check | |
| run: ruff check src/bluenamer | |
| - name: Ruff format check | |
| run: ruff format --check src/bluenamer | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: Set up JDK (for OPSIN) | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Install package | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run fast tests | |
| run: | | |
| pytest -m "not slow and not dataset and not golden" \ | |
| --maxfail=20 \ | |
| --durations=20 | |
| rdkit-compat: | |
| # Strict golden-output regression across RDKit versions. Detects | |
| # naming output that drifts with the RDKit upgrade cycle (aromaticity, | |
| # kekulisation, H-count perception). Each matrix row pins a specific | |
| # rdkit and runs only the `golden` test. | |
| runs-on: ubuntu-latest | |
| needs: [lint] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rdkit-version: | |
| - "2024.03.6" | |
| - "2024.09.6" | |
| - "2025.03.6" | |
| - "2025.09.5" | |
| - "2026.3.2" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| - name: Install package + pinned rdkit | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| pip install --force-reinstall --no-deps "rdkit==${{ matrix.rdkit-version }}" | |
| - name: Show installed versions | |
| run: | | |
| python -c "import rdkit, sys; print('python', sys.version); print('rdkit', rdkit.__version__)" | |
| - name: Run golden corpus test | |
| run: pytest -m golden -v --no-header -rA | |
| docker: | |
| runs-on: ubuntu-latest | |
| needs: [lint] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-buildx-action@v3 | |
| - name: Build image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: false | |
| load: true | |
| tags: bluenamer:ci | |
| - name: Smoke-test the image | |
| run: | | |
| docker run -d --name bluenamer-ci -p 8000:8000 bluenamer:ci | |
| for i in $(seq 1 30); do | |
| if curl -fsS http://127.0.0.1:8000/healthz > /tmp/health.json; then | |
| cat /tmp/health.json | |
| exit 0 | |
| fi | |
| sleep 2 | |
| done | |
| docker logs bluenamer-ci | |
| exit 1 |