change CI to include uv installation #597
This file contains 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: testing | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4.3.0 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
cache-dependency-path: "pyproject.toml" | |
- name: Install uv | |
run: | | |
pip install --upgrade pip | |
pip install uv | |
- name: Activate virtualenv | |
run: | | |
uv venv | |
. .venv/bin/activate | |
echo PATH=$PATH >> $GITHUB_ENV | |
- name: Install python dependencies | |
run: | | |
uv pip install --upgrade ruff mypy | |
- name: ruff | |
run: | | |
ruff --version | |
ruff check | |
- name: mypy | |
run: | | |
mypy --version | |
rm -rf .mypy_cache | |
mypy src/rxn_network | |
test: | |
strategy: | |
max-parallel: 6 | |
matrix: | |
os: [ubuntu-latest] | |
python_version: ["3.9", "3.10", "3.11"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python_version }} | |
uses: actions/setup-python@v4.3.0 | |
with: | |
python-version: ${{ matrix.python_version }} | |
cache: "pip" | |
cache-dependency-path: "pyproject.toml" | |
- name: Install uv | |
run: | | |
pip install --upgrade pip | |
pip install uv | |
- name: Activate virtualenv | |
run: | | |
uv venv | |
. .venv/bin/activate | |
echo PATH=$PATH >> $GITHUB_ENV | |
- name: Install python dependencies | |
run: | | |
uv pip install -e .[strict,tests] | |
- name: Test with pytest | |
env: | |
MP_API_KEY: ${{ secrets.MP_API_KEY }} | |
run: | | |
. .venv/bin/activate | |
pytest --cov=src/rxn_network --cov-report=xml | |
- uses: codecov/codecov-action@v3.1.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install pandoc | |
run: sudo apt-get install pandoc | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4.3.0 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
cache-dependency-path: "pyproject.toml" | |
- name: Install uv | |
run: | | |
pip install --upgrade pip | |
pip install uv | |
- name: Activate virtualenv | |
run: | | |
uv venv | |
. .venv/bin/activate | |
echo PATH=$PATH >> $GITHUB_ENV | |
- name: Install python dependencies | |
run: | | |
uv pip install -e .[strict,tests] | |
- name: Build | |
run: sphinx-build docs docs_build |