-
Notifications
You must be signed in to change notification settings - Fork 453
123 lines (121 loc) · 3.97 KB
/
docs.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# This workflow builds the torchrec docs and deploys them to gh-pages.
name: Generate documentation
on:
push:
branches:
- main
workflow_dispatch:
pull_request:
jobs:
build_docs_job:
runs-on: ${{ matrix.os }}
permissions:
# Grant write permission here so that the doc can be pushed to gh-pages branch
contents: write
strategy:
matrix:
include:
- os: linux.20_04.4x
python-version: 3.9
python-tag: "py39"
steps:
- name: Check ldd --version
run: ldd --version
- name: Checkout
uses: actions/checkout@v2
# Update references
- name: Update pip
run: |
sudo apt-get update
sudo apt-get -y install python3-pip
sudo pip3 install --upgrade pip
- name: Setup conda
run: |
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/miniconda
- name: setup Path
run: |
echo "/home/ec2-user/miniconda/bin" >> $GITHUB_PATH
echo "CONDA=/home/ec2-user/miniconda" >> $GITHUB_PATH
- name: create conda env
run: |
conda create --name build_binary python=${{ matrix.python-version }}
conda info
- name: check python version no Conda
run: |
python --version
- name: check python version
run: |
conda run -n build_binary python --version
- name: Install gcc
shell: bash
run: |
sudo apt-get install build-essential
- name: setup Path
run: |
echo /usr/local/bin >> $GITHUB_PATH
- name: Install PyTorch
shell: bash
run: |
conda install -n build_binary --yes pytorch cpuonly -c pytorch-nightly
- name: Install fbgemm
run: |
conda run -n build_binary pip install fbgemm-gpu --index-url https://download.pytorch.org/whl/nightly/cpu
- name: Install torchmetrics
run: |
conda run -n build_binary pip install torchmetrics==1.0.3
- name: Install TorchRec
run: |
conda run -n build_binary pip install -r requirements.txt
conda run -n build_binary python setup.py bdist_wheel --python-tag=${{ matrix.python-tag }}
- name: Test fbgemm_gpu and torchrec installation
shell: bash
run: |
conda run -n build_binary \
python -c "import fbgemm_gpu"
conda run -n build_binary \
python -c "import torchrec"
- name: Build the docset
run: |
conda run -n build_binary python -m pip install -r docs/requirements.txt
cd ./docs
conda run -n build_binary make html
cd ..
- name: Upload Built-Docs
uses: actions/upload-artifact@v3
with:
name: Built-Docs
path: docs/build/html/
- name: Get output time
run: echo "The time was ${{ steps.build.outputs.time }}"
- name: Deploy
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: docs/build/html # The folder the action should deploy.
doc-preview:
runs-on: [linux.2xlarge]
needs: build_docs_job
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: Built-Docs
path: docs
- name: Add no-index tag
run: |
find docs -name "*.html" -print0 | xargs -0 sed -i '/<head>/a \ \ <meta name="robots" content="noindex">';
- name: Upload docs preview
uses: seemethere/upload-artifact-s3@v5
if: ${{ github.event_name == 'pull_request' }}
with:
retention-days: 14
s3-bucket: doc-previews
if-no-files-found: error
path: docs
s3-prefix: pytorch/torchrec/${{ github.event.pull_request.number }}