Skip to content

Commit

Permalink
feat: using pip to manage dependencies in CI testing workflow, and us…
Browse files Browse the repository at this point in the history
…ing conda in Daily testing workflow;
  • Loading branch information
WenjieDu committed Sep 21, 2023
1 parent e71d1f6 commit b2da1c0
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 64 deletions.
64 changes: 44 additions & 20 deletions .github/workflows/testing_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,67 @@ jobs:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
shell: bash {0}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: ["3.7", "3.10"]
torch-version: ["1.13.1"]

steps:
- name: Check out the repo code
uses: actions/checkout@v3

- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2
- name: Determine the Python version
uses: haya14busa/action-cond@v1
id: condval
with:
activate-environment: pypots-test
python-version: ${{ matrix.python-version }}
environment-file: tests/environment_for_conda_test.yml
auto-activate-base: false
cond: ${{ matrix.python-version == 3.7 && matrix.os == 'macOS-latest' }}
# Note: the latest 3.7 subversion 3.7.17 for MacOS has "ModuleNotFoundError: No module named '_bz2'"
if_true: "3.7.16"
if_false: ${{ matrix.python-version }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ steps.condval.outputs.value }}
check-latest: true
cache: pip
cache-dependency-path: |
setup.cfg
- name: Install PyTorch ${{ matrix.torch-version }}+cpu
# we have to install torch in advance because torch_sparse needs it for compilation,
# refer to https://github.com/rusty1s/pytorch_sparse/issues/156#issuecomment-1304869772 for details
run: |
which python
which pip
python -m pip install --upgrade pip
pip install torch==${{ matrix.torch-version }} -f https://download.pytorch.org/whl/cpu
python -c "import torch; print('PyTorch:', torch.__version__)"
- name: Install other dependencies
run: |
pip install pypots
pip install torch-geometric torch-scatter torch-sparse -f "https://data.pyg.org/whl/torch-${{ matrix.torch-version }}+cpu.html"
pip install -e ".[dev]"
- name: Fetch the test environment details
run: |
which python
conda info
conda list
pip list
- name: Test with pytest
run: |
# run tests separately here due to Segmentation Fault in test_clustering when run all in
# one command with `pytest` on MacOS. Bugs not caught, so this is a trade-off to avoid SF.
python -m pytest -rA tests/classification/* -n auto --cov=pypots --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/imputation/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/clustering/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/forecasting/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/optim/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/data/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/utils/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/cli/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
coverage run --source=pypots -m pytest -rA tests/classification/*
coverage run --source=pypots -m pytest -rA tests/imputation/*
coverage run --source=pypots -m pytest -rA tests/clustering/*
coverage run --source=pypots -m pytest -rA tests/forecasting/*
coverage run --source=pypots -m pytest -rA tests/optim/*
coverage run --source=pypots -m pytest -rA tests/data/*
coverage run --source=pypots -m pytest -rA tests/utils/*
coverage run --source=pypots -m pytest -rA tests/cli/*
- name: Generate the LCOV report
run: |
Expand All @@ -61,4 +85,4 @@ jobs:
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: 'coverage.lcov'
path-to-lcov: "coverage.lcov"
64 changes: 20 additions & 44 deletions .github/workflows/testing_daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,67 +10,43 @@ jobs:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash {0}
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: ["3.7", "3.10"]
torch-version: ["1.13.1"]

steps:
- name: Check out the repo code
uses: actions/checkout@v3

- name: Determine the Python version
uses: haya14busa/action-cond@v1
id: condval
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2
with:
cond: ${{ matrix.python-version == 3.7 && matrix.os == 'macOS-latest' }}
# Note: the latest 3.7 subversion 3.7.17 for MacOS has "ModuleNotFoundError: No module named '_bz2'"
if_true: "3.7.16"
if_false: ${{ matrix.python-version }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ steps.condval.outputs.value }}
check-latest: true
cache: pip
cache-dependency-path: |
setup.cfg
- name: Install PyTorch ${{ matrix.torch-version }}+cpu
# we have to install torch in advance because torch_sparse needs it for compilation,
# refer to https://github.com/rusty1s/pytorch_sparse/issues/156#issuecomment-1304869772 for details
run: |
which python
which pip
python -m pip install --upgrade pip
pip install torch==${{ matrix.torch-version }} -f https://download.pytorch.org/whl/cpu
python -c "import torch; print('PyTorch:', torch.__version__)"
- name: Install other dependencies
run: |
pip install pypots
pip install torch-geometric torch-scatter torch-sparse -f "https://data.pyg.org/whl/torch-${{ matrix.torch-version }}+cpu.html"
pip install -e ".[dev]"
activate-environment: pypots-test
python-version: ${{ matrix.python-version }}
environment-file: tests/environment_for_conda_test.yml
auto-activate-base: false

- name: Fetch the test environment details
run: |
which python
pip list
conda info
conda list
- name: Test with pytest
run: |
coverage run --source=pypots -m pytest -rA tests/classification/*
coverage run --source=pypots -m pytest -rA tests/imputation/*
coverage run --source=pypots -m pytest -rA tests/clustering/*
coverage run --source=pypots -m pytest -rA tests/forecasting/*
coverage run --source=pypots -m pytest -rA tests/optim/*
coverage run --source=pypots -m pytest -rA tests/data/*
coverage run --source=pypots -m pytest -rA tests/utils/*
coverage run --source=pypots -m pytest -rA tests/cli/*
# run tests separately here due to Segmentation Fault in test_clustering when run all in
# one command with `pytest` on MacOS. Bugs not caught, so this is a trade-off to avoid SF.
python -m pytest -rA tests/classification/* -n auto --cov=pypots --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/imputation/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/clustering/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/forecasting/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/optim/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/data/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/utils/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
python -m pytest -rA tests/cli/* -n auto --cov=pypots --cov-append --dist=loadgroup --cov-config=.coveragerc
- name: Generate the LCOV report
run: |
Expand All @@ -80,4 +56,4 @@ jobs:
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "coverage.lcov"
path-to-lcov: 'coverage.lcov'

0 comments on commit b2da1c0

Please sign in to comment.