Ported more tests from scholidonline #2
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: | |
| jobs: | |
| test-and-check: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install package and dev dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run Ruff lint | |
| run: | | |
| ruff check . | |
| - name: Run Ruff format check | |
| run: | | |
| ruff format --check . | |
| - name: Run mypy | |
| run: | | |
| mypy src | |
| - name: Run pytest with coverage | |
| run: | | |
| pytest tests/unit \ | |
| --cov=idutils_online \ | |
| --cov-report=term-missing \ | |
| --cov-report=xml \ | |
| --cov-report=html | |
| - name: Upload HTML coverage artifact | |
| if: matrix.python-version == '3.11' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: htmlcov | |
| path: htmlcov/ | |
| - name: Upload coverage to Codecov | |
| if: matrix.python-version == '3.11' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: Thomas-Rauter/idutils-online | |
| - name: Build package | |
| if: matrix.python-version == '3.11' | |
| run: | | |
| python -m build | |
| - name: Check package metadata | |
| if: matrix.python-version == '3.11' | |
| run: | | |
| python -m pip install twine | |
| python -m twine check dist/* | |
| - name: Smoke test installed wheel | |
| if: matrix.python-version == '3.11' | |
| run: | | |
| python -m venv /tmp/idutils-online-wheel-test | |
| /tmp/idutils-online-wheel-test/bin/python -m pip install --upgrade pip | |
| /tmp/idutils-online-wheel-test/bin/python -m pip install dist/*.whl | |
| cd /tmp | |
| /tmp/idutils-online-wheel-test/bin/python - <<'PY' | |
| from idutils_online import id_convert, id_exists, id_links, id_metadata | |
| from idutils_online.registry import capabilities, online_types | |
| types = online_types() | |
| assert "pmid" in types | |
| assert "doi" in types | |
| assert len(capabilities()) > 0 | |
| assert callable(id_exists) | |
| assert callable(id_metadata) | |
| assert callable(id_links) | |
| assert callable(id_convert) | |
| print("installed wheel smoke test passed") | |
| PY | |
| docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install package and docs dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[docs]" | |
| - name: Build documentation | |
| run: | | |
| mkdocs build --strict |