This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
[pre-commit.ci] pre-commit suggestions (#44) #308
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: CI testing | |
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows | |
on: # Trigger the workflow on push or pull request, but only for the main branch | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
pytest: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macOS-11] | |
python-version: [3.8] | |
requires: ['oldest', 'latest'] | |
# Timeout: https://stackoverflow.com/a/59076067/4521646 | |
timeout-minutes: 35 | |
env: | |
HOROVOD_BUILD_ARCH_FLAGS: "-mfma" | |
HOROVOD_WITHOUT_MXNET: 1 | |
HOROVOD_WITHOUT_TENSORFLOW: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup macOS | |
if: runner.os == 'macOS' | |
# Horovod on macOS requires OpenMPI, Gloo not currently supported | |
run: brew install openmpi libuv | |
- name: Set min. dependencies | |
if: matrix.requires == 'oldest' | |
run: | | |
for fpath in ('requirements.txt', 'tests/requirements.txt'): | |
req = open(fpath).read().replace('>=', '==') | |
open(fpath, 'w').write(req) | |
shell: python | |
- name: Install package & dependencies | |
run: | | |
pip install "pip<23.0" # HotFix for bad Horovod requirements | |
pip install -e . -U -r tests/requirements.txt \ | |
--find-links https://download.pytorch.org/whl/cpu/torch_stable.html | |
pip list | |
shell: bash | |
- name: Reinstall Horovod if necessary | |
run: | | |
HOROVOD_BUILT=$(python -c "import horovod.torch; horovod.torch.nccl_built(); print('SUCCESS')" || true) | |
if [[ $HOROVOD_BUILT != "SUCCESS" ]]; then | |
pip uninstall -y horovod | |
grep "horovod" requirements.txt > _requirements.txt | |
pip install --no-cache-dir -r _requirements.txt | |
fi | |
horovodrun --check-build | |
python -c "import horovod.torch" | |
pip list | |
- name: Testing | |
env: | |
PL_USE_MOCKED_MNIST: 1 | |
run: pytest src/ tests/ --cov=lightning_horovod -v | |
- name: Statistics | |
run: | | |
coverage report | |
coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
flags: unittests | |
env_vars: OS,PYTHON | |
name: codecov-umbrella | |
fail_ci_if_error: false |