This repository has been archived by the owner on Dec 12, 2022. It is now read-only.
forked from MatthewHowe/DCNv2
-
Notifications
You must be signed in to change notification settings - Fork 10
78 lines (68 loc) · 2.42 KB
/
ci-testing.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: CI testing
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
python-version: [3.8]
cuda-version: [11.8]
type: [cpu, gpu]
# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 35
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Get pip cache
id: pip-cache
run: |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
- name: Cache pip
uses: actions/cache@v2.1.4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles(format('requirements-{0}.txt', matrix.type)) }}
restore-keys: |
${{ runner.os }}-py${{ matrix.python-version }}-
- name: Install dependencies
run: |
pip install -r ${{ format('requirements-{0}.txt', matrix.type) }} --upgrade --quiet --find-links https://download.pytorch.org/whl/torch_stable.html
python --version
pip --version
pip list
shell: bash
- name: Install CUDA
if: matrix.type == 'gpu'
env:
cuda: ${{ matrix.cuda-version }}
run: |
source .github/workflows/install_cuda_ubuntu.sh
if [[ $? -eq 0 ]]; then
# Set paths for subsequent steps, using ${CUDA_PATH}
echo "Adding CUDA to CUDA_PATH, PATH and LD_LIBRARY_PATH"
echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV
echo "${CUDA_PATH}/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
fi
shell: bash
- name: Install Ninja
run: sudo apt-get install ninja-build
- name: Run JIT Compilation
run: |
export PYTHONPATH=${PWD}:$PYTHONPATH
python DCN/dcn_v2.py
- name: Run test
if: matrix.type == 'cpu'
run: |
export PYTHONPATH=${PWD}/DCN:$PYTHONPATH
cd tests
python test_cpu.py
shell: bash