Skip to content

Commit

Permalink
Test upload artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
DanilBaibak committed Nov 9, 2023
1 parent 48dc16b commit a515e9f
Showing 1 changed file with 74 additions and 71 deletions.
145 changes: 74 additions & 71 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,86 +31,89 @@ jobs:
# Update references
- name: Script
run: |
root_dir="$(pwd)"
conda_dir="${root_dir}/conda"
env_dir="${root_dir}/env"
os=Linux
# 1. Install conda at ./conda
printf "* Installing conda\n"
wget -O miniconda.sh "http://repo.continuum.io/miniconda/Miniconda3-latest-${os}-x86_64.sh"
bash ./miniconda.sh -b -f -p "${conda_dir}"
eval "$(${conda_dir}/bin/conda shell.bash hook)"
printf "* Creating a test environment\n"
conda create --prefix "${env_dir}" -y python=3.8
printf "* Activating\n"
conda activate "${env_dir}"
# 2. upgrade pip, ninja and packaging
apt-get install python3.8 python3-pip -y
python3 -m pip install --upgrade pip
python3 -m pip install setuptools ninja packaging -U
# 3. check python version
python3 --version
# 4. Check git version
git version
# 5. Install PyTorch
python3 -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu --quiet --root-user-action=ignore
# 6. Install tensordict
python3 -m pip install git+https://github.com/pytorch/tensordict.git --quiet --root-user-action=ignore
# 7. Install TorchRL
python3 setup.py develop
# 8. Install requirements
python3 -m pip install -r docs/requirements.txt --quiet --root-user-action=ignore
# 9. Test torchrl installation
mkdir _tmp
cd _tmp
PYOPENGL_PLATFORM=egl MUJOCO_GL=egl python3 -c """from torchrl.envs.libs.dm_control import DMControlEnv
print(DMControlEnv('cheetah', 'run', from_pixels=True).reset())"""
cd ..
# 10. Build doc
cd ./docs
# timeout 7m bash -ic "MUJOCO_GL=egl sphinx-build ./source _local_build" || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
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
# PYOPENGL_PLATFORM=egl MUJOCO_GL=egl sphinx-build ./source _local_build
cd ..
- name: Install rsync 📚
run: |
apt-get update && apt-get install -y rsync
- name: Pull TensorDict docs
run: |
git clone --branch gh-pages https://github.com/pytorch/tensordict.git docs/_local_build/tensordict
rm -rf docs/_local_build/tensordict/.git
- name: Get output time
run: echo "The time was ${{ steps.build.outputs.time }}"
mkdir docs/_local_build
echo "Hello World" >> docs/_local_build/index.html
# root_dir="$(pwd)"
# conda_dir="${root_dir}/conda"
# env_dir="${root_dir}/env"
# os=Linux
#
# # 1. Install conda at ./conda
# printf "* Installing conda\n"
# wget -O miniconda.sh "http://repo.continuum.io/miniconda/Miniconda3-latest-${os}-x86_64.sh"
# bash ./miniconda.sh -b -f -p "${conda_dir}"
# eval "$(${conda_dir}/bin/conda shell.bash hook)"
# printf "* Creating a test environment\n"
# conda create --prefix "${env_dir}" -y python=3.8
# printf "* Activating\n"
# conda activate "${env_dir}"
#
# # 2. upgrade pip, ninja and packaging
# apt-get install python3.8 python3-pip -y
# python3 -m pip install --upgrade pip
# python3 -m pip install setuptools ninja packaging -U
#
# # 3. check python version
# python3 --version
#
# # 4. Check git version
# git version
#
# # 5. Install PyTorch
# python3 -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu --quiet --root-user-action=ignore
#
# # 6. Install tensordict
# python3 -m pip install git+https://github.com/pytorch/tensordict.git --quiet --root-user-action=ignore
#
# # 7. Install TorchRL
# python3 setup.py develop
#
# # 8. Install requirements
# python3 -m pip install -r docs/requirements.txt --quiet --root-user-action=ignore
#
# # 9. Test torchrl installation
# mkdir _tmp
# cd _tmp
# PYOPENGL_PLATFORM=egl MUJOCO_GL=egl python3 -c """from torchrl.envs.libs.dm_control import DMControlEnv
# print(DMControlEnv('cheetah', 'run', from_pixels=True).reset())"""
# cd ..
#
# # 10. Build doc
# cd ./docs
# # timeout 7m bash -ic "MUJOCO_GL=egl sphinx-build ./source _local_build" || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
# 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
# # PYOPENGL_PLATFORM=egl MUJOCO_GL=egl sphinx-build ./source _local_build
# cd ..
# - name: Install rsync 📚
# run: |
# apt-get update && apt-get install -y rsync
# - name: Pull TensorDict docs
# run: |
# git clone --branch gh-pages https://github.com/pytorch/tensordict.git docs/_local_build/tensordict
# rm -rf docs/_local_build/tensordict/.git
# - name: Get output time
# run: echo "The time was ${{ steps.build.outputs.time }}"
- name: Upload wheel for download
uses: actions/upload-artifact@v2
with:
name: docs
name: build
path: docs/_local_build/
- name: Deploy
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages # The branch the action should deploy to.
folder: docs/_local_build/ # The folder the action should deploy.
CLEAN: false
# - name: Deploy
# if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
# uses: JamesIves/github-pages-deploy-action@releases/v4
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# branch: gh-pages # The branch the action should deploy to.
# folder: docs/_local_build/ # The folder the action should deploy.
# CLEAN: false

upload-docs:
needs: build_docs_job
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: pytorch/rl
runner: linux.2xlarge
download-artifact: docs
download-artifact: build
script: |
cp -r docs/* "${RUNNER_DOCS_DIR}"
cp -r ${RUNNER_TEMP}/artifacts/build/* "${RUNNER_DOCS_DIR}"

0 comments on commit a515e9f

Please sign in to comment.