-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable pip cache dependencies in GH Actions (#226)
* Rename to ci-test.yml * Fix the cache directory * Add Python - pip cache to ci-test Actions * Update to the new badges * Adjust the badges * Adopt the urls in pages * Consistent naming
- Loading branch information
Showing
3 changed files
with
58 additions
and
32 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,56 +10,76 @@ on: | |
branches: [ main ] | ||
|
||
jobs: | ||
UnitTest: | ||
Unittest: | ||
runs-on: ${{ matrix.image }} | ||
strategy: | ||
matrix: | ||
python-version: [ 3.7 ] | ||
image: [ 'ubuntu-latest' ] | ||
torch: [ '1.9.1+cpu', '1.10.0+cpu' ] | ||
torch: [ 'torch 1.9.1+cpu', 'torch 1.10.0+cpu' ] | ||
include: | ||
- torch: '1.9.1+cpu' | ||
- torch: 'torch 1.9.1+cpu' | ||
torch_address: torch==1.9.1+cpu torchvision==0.10.1+cpu -f https://download.pytorch.org/whl/torch_stable.html | ||
unittest_type: --cov=test --cov-report=xml | ||
torchvision: release/0.10 | ||
- torch: '1.10.0+cpu' | ||
- torch: 'torch 1.10.0+cpu' | ||
torch_address: install torch==1.10.0+cpu torchvision==0.11.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html | ||
unittest_type: --cov=test --cov-report=xml | ||
torchvision: release/0.11 | ||
|
||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: 'x64' | ||
python-version: '3.8' | ||
|
||
- name: Upgrade pip | ||
run: | | ||
# install pip=>20.1 to use "pip cache dir" | ||
python -m pip install --progress-bar off --upgrade pip | ||
- name: Get pip cache dir | ||
id: pip-cache | ||
run: echo "::set-output name=dir::$(pip cache dir)" | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install PyTorch ${{ matrix.torch }} Version | ||
run: | | ||
python -m pip install --upgrade pip | ||
# requirements for PyTorch and torchvision | ||
pip install numpy pillow scipy | ||
pip install ${{ matrix.torch_address }} | ||
pip install --progress-bar off numpy pillow scipy | ||
pip install --progress-bar off ${{ matrix.torch_address }} | ||
- name: Install dependencies | ||
run: | | ||
# requirements for unittest | ||
pip install flake8 pytest | ||
pip install pytest-cov | ||
pip install --progress-bar off flake8 pytest | ||
pip install --progress-bar off pytest-cov | ||
# Install other dependencies | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
pip install opencv-python | ||
pip install pycocotools>=2.0.2 | ||
pip install onnxruntime | ||
if [ -f requirements.txt ]; then pip install --progress-bar off -r requirements.txt; fi | ||
pip install --progress-bar off opencv-python | ||
pip install --progress-bar off pycocotools>=2.0.2 | ||
pip install --progress-bar off onnxruntime | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=18 --max-line-length=120 --statistics | ||
- name: Test and Generate coverage report | ||
run: | | ||
PYTORCH_TEST_WITH_SLOW=1 pytest ${{ matrix.unittest_type }} | ||
- name: Upload coverage to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
|
@@ -70,6 +90,7 @@ jobs: | |
name: codecov-umbrella | ||
fail_ci_if_error: true | ||
verbose: true | ||
|
||
- name: Build TorchVision Cpp ${{ matrix.torch }} | ||
run: | | ||
export TORCH_PATH=$(dirname $(python -c "import torch; print(torch.__file__)")) | ||
|
@@ -81,9 +102,11 @@ jobs: | |
cmake .. -DTorch_DIR=$TORCH_PATH/share/cmake/Torch | ||
make -j4 | ||
sudo make install | ||
- name: Export torchscript model | ||
run: | | ||
python -m test.tracing.trace_model | ||
- name: Test libtorch tracing | ||
run: | | ||
export TORCH_PATH=$(dirname $(python -c "import torch; print(torch.__file__)")) | ||
|
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
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