@@ -16,25 +16,26 @@ concurrency:
16
16
cancel-in-progress : true
17
17
18
18
jobs :
19
- build_docs_job :
20
- runs-on : linux.g5.4xlarge.nvidia.gpu
21
- defaults :
22
- run :
23
- shell : bash -l {0}
24
- container : nvidia/cudagl:11.4.0-runtime
25
- steps :
26
- - name : Install deps
27
- run : |
19
+ build-docs :
20
+ strategy :
21
+ matrix :
22
+ python_version : ["3.9"]
23
+ cuda_arch_version : ["12.1"]
24
+ uses : pytorch/test-infra/.github/workflows/linux_job.yml@main
25
+ with :
26
+ repository : pytorch/rl
27
+ runner : " linux.g5.4xlarge.nvidia.gpu"
28
+ docker-image : " nvidia/cudagl:11.4.0-base"
29
+ timeout : 120
30
+ script : |
31
+ set -e
32
+ set -v
28
33
apt-get update && apt-get install -y git wget gcc g++
29
- - name : Checkout
30
- uses : actions/checkout@v3
31
- # Update references
32
- - name : Setup conda
33
- run : |
34
34
root_dir="$(pwd)"
35
35
conda_dir="${root_dir}/conda"
36
36
env_dir="${root_dir}/env"
37
37
os=Linux
38
+
38
39
# 1. Install conda at ./conda
39
40
printf "* Installing conda\n"
40
41
wget -O miniconda.sh "http://repo.continuum.io/miniconda/Miniconda3-latest-${os}-x86_64.sh"
@@ -44,64 +45,97 @@ jobs:
44
45
conda create --prefix "${env_dir}" -y python=3.8
45
46
printf "* Activating\n"
46
47
conda activate "${env_dir}"
47
- - name : Update pip
48
- run : |
48
+
49
+ # 2. upgrade pip, ninja and packaging
49
50
apt-get install python3.8 python3-pip -y
50
- pip3 install --upgrade pip
51
- - name : check python version
52
- run : |
51
+ python3 -m pip install --upgrade pip
52
+ python3 -m pip install setuptools ninja packaging -U
53
+
54
+ # 3. check python version
53
55
python3 --version
54
- - name : Check git version
55
- run : git version
56
- - name : Install PyTorch
57
- shell : bash
58
- run : |
59
- pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu --quiet --root-user-action=ignore
60
- #pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu118 --quiet --root-user-action=ignore
61
- - name : Install tensordict
62
- run : |
63
- pip3 install git+https://github.com/pytorch/tensordict.git --quiet --root-user-action=ignore
64
- - name : Install TorchRL
65
- run : |
56
+
57
+ # 4. Check git version
58
+ git version
59
+
60
+ # 5. Install PyTorch
61
+ python3 -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu --quiet --root-user-action=ignore
62
+
63
+ # 6. Install tensordict
64
+ python3 -m pip install git+https://github.com/pytorch/tensordict.git --quiet --root-user-action=ignore
65
+
66
+ # 7. Install TorchRL
66
67
python3 setup.py develop
67
- - name : Install requirements
68
- run : |
69
- pip3 install -r docs/requirements.txt --quiet --root-user-action=ignore
70
- - name : Test torchrl installation
71
- shell : bash
72
- run : |
68
+
69
+ # 8. Install requirements
70
+ python3 -m pip install -r docs/requirements.txt --quiet --root-user-action=ignore
71
+
72
+ # 9. Test torchrl installation
73
73
mkdir _tmp
74
74
cd _tmp
75
75
PYOPENGL_PLATFORM=egl MUJOCO_GL=egl python3 -c """from torchrl.envs.libs.dm_control import DMControlEnv
76
76
print(DMControlEnv('cheetah', 'run', from_pixels=True).reset())"""
77
77
cd ..
78
- - name : Build the docset
79
- id : build_doc
80
- run : |
78
+
79
+ # 10. Build doc
81
80
cd ./docs
82
81
# timeout 7m bash -ic "MUJOCO_GL=egl sphinx-build ./source _local_build" || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
83
- bash -ic "PYOPENGL_PLATFORM=egl MUJOCO_GL=egl sphinx-build ./source _local_build" || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
84
- # PYOPENGL_PLATFORM=egl MUJOCO_GL=egl sphinx-build ./source _local_build
82
+ # bash -ic "PYOPENGL_PLATFORM=egl MUJOCO_GL=egl sphinx-build ./source _local_build" || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
83
+ PYOPENGL_PLATFORM=egl MUJOCO_GL=egl sphinx-build ./source _local_build
85
84
cd ..
86
- - name : Install rsync 📚
87
- run : |
88
- apt-get update && apt-get install -y rsync
89
- - name : Pull TensorDict docs
90
- run : |
91
- git clone --branch gh-pages https://github.com/pytorch/tensordict.git docs/_local_build/tensordict
92
- rm -rf docs/_local_build/tensordict/.git
93
- - name : Get output time
94
- run : echo "The time was ${{ steps.build.outputs.time }}"
95
- - name : Upload wheel for download
96
- uses : actions/upload-artifact@v2
97
- with :
98
- name : build
99
- path : docs/_local_build/
100
- - name : Deploy
101
- if : ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
102
- uses : JamesIves/github-pages-deploy-action@releases/v4
103
- with :
104
- token : ${{ secrets.GITHUB_TOKEN }}
105
- branch : gh-pages # The branch the action should deploy to.
106
- folder : docs/_local_build/ # The folder the action should deploy.
107
- CLEAN : false
85
+ cp -r docs/_local_build "${RUNNER_ARTIFACT_DIR}"
86
+ cp -r docs/_local_build/* "${RUNNER_DOCS_DIR}"
87
+
88
+ upload :
89
+ needs : build-docs
90
+ if : github.repository == 'pytorch/rl' && github.event_name == 'push' &&
91
+ ((github.ref_type == 'branch' && github.ref_name == 'main') || github.ref_type == 'tag')
92
+ permissions :
93
+ contents : write
94
+ uses : pytorch/test-infra/.github/workflows/linux_job.yml@main
95
+ with :
96
+ repository : pytorch/rl
97
+ download-artifact : docs
98
+ ref : gh-pages
99
+ test-infra-ref : main
100
+ script : |
101
+ set -euo pipefail
102
+
103
+ REF_TYPE=${{ github.ref_type }}
104
+ REF_NAME=${{ github.ref_name }}
105
+
106
+ # TODO: adopt this behaviour
107
+ # if [[ "${REF_TYPE}" == branch ]]; then
108
+ # TARGET_FOLDER="${REF_NAME}"
109
+ # elif [[ "${REF_TYPE}" == tag ]]; then
110
+ # case "${REF_NAME}" in
111
+ # *-rc*)
112
+ # echo "Aborting upload since this is an RC tag: ${REF_NAME}"
113
+ # exit 0
114
+ # ;;
115
+ # *)
116
+ # # Strip the leading "v" as well as the trailing patch version. For example:
117
+ # # 'v0.15.2' -> '0.15'
118
+ # TARGET_FOLDER=$(echo "${REF_NAME}" | sed 's/v\([0-9]\+\)\.\([0-9]\+\)\.[0-9]\+/\1.\2/')
119
+ # ;;
120
+ # esac
121
+ # fi
122
+ # echo "Target Folder: ${TARGET_FOLDER}"
123
+ TARGET_FOLDER="./"
124
+
125
+ # mkdir -p "${TARGET_FOLDER}"
126
+ # rm -rf "${TARGET_FOLDER}"/*
127
+ mv "${RUNNER_ARTIFACT_DIR}"/html/* "${TARGET_FOLDER}"
128
+ git add "${TARGET_FOLDER}" || true
129
+
130
+ # if [[ "${TARGET_FOLDER}" == main ]]; then
131
+ # mkdir -p _static
132
+ # rm -rf _static/*
133
+ # cp -r "${TARGET_FOLDER}"/_static/* _static
134
+ # git add _static || true
135
+ # fi
136
+
137
+ git config user.name 'pytorchbot'
138
+ git config user.email '[email protected] '
139
+ git config http.postBuffer 524288000
140
+ git commit -m "auto-generating sphinx docs" || true
141
+ git push
0 commit comments