Skip to content

Commit

Permalink
ci: skip dataset downloads (#1023)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed May 31, 2023
1 parent 514b22a commit a746a76
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 31 deletions.
55 changes: 28 additions & 27 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
requires: ['oldest', 'latest']
env:
FREEZE_REQUIREMENTS: 1
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html"
# Timeout: https://stackoverflow.com/a/59076067/4521646
# the reason for high number is MUCH slower tests on macOS and py3.8
timeout-minutes: 50
Expand All @@ -39,20 +40,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

# Github Actions: Run step on specific OS: https://stackoverflow.com/a/57948488/4521646
- name: Setup macOS
if: runner.os == 'macOS'
run: |
brew update # Todo: find a better way...
brew install libomp # https://github.com/pytorch/pytorch/issues/20030
brew install rar
- name: Setup Ubuntu
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y unrar
- name: Set min. dependencies
if: matrix.requires == 'oldest'
run: |
Expand All @@ -66,19 +53,17 @@ jobs:
- name: Install package
run: |
pip install "pip==22.2.1" # todo: drop after resolving extras
pip install -e . "coverage[toml]" --upgrade --prefer-binary \
-f https://download.pytorch.org/whl/cpu/torch_stable.html
pip install -e . -U --prefer-binary -f ${TORCH_URL}
pip list
- name: Test Package [only]
working-directory: ./src
run: |
pip install pytest -q
pip install "coverage[toml]" pytest -q
# TODO: package shall be fine to run full without any ignores
python -m pytest . \
--ignore=pl_bolts/datamodules \
--ignore=pl_bolts/datasets \
--ignore=pl_bolts/models/self_supervised/amdim/transforms.py \
--ignore=pl_bolts/models/rl
- name: Get pip cache dir
Expand All @@ -89,34 +74,50 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements/*.txt') }}
key: ${{ runner.os }}-pip-${{ matrix.requires }}-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-
${{ runner.os }}-pip-${{ matrix.requires }}-
- name: Install dependencies
run: |
pip install -r requirements/devel.txt --upgrade --quiet \
--find-links https://download.pytorch.org/whl/cpu/torch_stable.html
pip install -r requirements/devel.txt -U -q -f ${TORCH_URL}
pip list
- name: Cache datasets
id: cache-datasets
uses: actions/cache@v3
with:
path: ./_datasets
key: pl-datasets-${{ hashFiles('tests/conftest.py') }}
# bump this date if you need update cache
key: datasets-20230601

- name: Setup macOS
if: runner.os == 'macOS' && steps.cache-datasets.outputs.cache-hit != 'true'
run: |
brew update
brew install rar
- name: Setup Ubuntu
if: runner.os == 'Linux'&& steps.cache-datasets.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y unrar
- name: Download ROMs
# continue-on-error: true
if: steps.cache-datasets.outputs.cache-hit != 'true'
run: |
mkdir -p _datasets
cd _datasets
curl http://www.atarimania.com/roms/Roms.rar -o Roms.rar
unrar x -y Roms.rar
python -m atari_py.import_roms ROMS
rm Roms.rar
- name: Init ROMs
working-directory: ./_datasets
run: python -m atari_py.import_roms ROMS

- name: Tests
run: |
python -m pytest tests -v --cov=pl_bolts
run: python -m pytest tests -v --cov=pl_bolts

- name: Statistics
if: success()
Expand Down
4 changes: 2 additions & 2 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from pytorch_lightning import seed_everything

TEST_ROOT = os.path.realpath(os.path.dirname(__file__))
PACKAGE_ROOT = os.path.dirname(TEST_ROOT)
DATASETS_PATH = os.path.join(PACKAGE_ROOT, "_datasets")
PROJECT_ROOT = os.path.dirname(TEST_ROOT)
DATASETS_PATH = os.path.join(PROJECT_ROOT, "_datasets")
# generate a list of random seeds for each test
ROOT_SEED = 1234

Expand Down
4 changes: 2 additions & 2 deletions tests/test_utilities.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

from tests import PACKAGE_ROOT
from tests import PROJECT_ROOT


def test_paths():
assert os.path.isdir(PACKAGE_ROOT)
assert os.path.isdir(PROJECT_ROOT)

0 comments on commit a746a76

Please sign in to comment.