@@ -20,9 +20,10 @@ concurrency:
2020 cancel-in-progress : false
2121
2222jobs :
23- # Build job: builds the documentation and uploads it as an artifact.
24- build :
23+ # Build job for GitHub
24+ build-github :
2525 runs-on : ubuntu-latest
26+ if : ${{ github.server_url == 'https://github.com' }}
2627 # Set ENV vars at the job level to be inherited by all steps, including actions
2728 env :
2829 NODE_EXTRA_CA_CERTS : /etc/ssl/certs/ca-certificates.crt
@@ -78,29 +79,75 @@ jobs:
7879 run : sphinx-build -b html -D html_baseurl="" docs/source docs/build
7980
8081 - name : Upload artifact for GitHub Pages
81- if : ${{ !env.ACT && github.server_url == 'https://github.com' }}
82+ if : ${{ !env.ACT }}
8283 uses : actions/upload-pages-artifact@v3
8384 with :
8485 path : ./docs/build
8586
86- - name : Upload artifact for Gitea
87- # Use a GHES-compatible version of upload-artifact for Gitea
88- if : ${{ github.server_url != 'https://github.com' }}
89- uses : actions/upload-artifact@v3
87+ - name : Upload artifact for GitHub
88+ uses : actions/upload-artifact@v4
9089 with :
9190 name : docs-artifact
9291 path : ./docs/build
9392
94- - name : Upload artifact for GitHub
95- if : ${{ github.server_url == 'https://github.com' }}
96- uses : actions/upload-artifact@v4
93+ # Build job for Gitea
94+ build-gitea :
95+ runs-on : ubuntu-latest
96+ if : ${{ github.server_url != 'https://github.com' }}
97+ env :
98+ NODE_EXTRA_CA_CERTS : /etc/ssl/certs/ca-certificates.crt
99+ SSL_CERT_FILE : /etc/ssl/certs/ca-certificates.crt
100+ REQUESTS_CA_BUNDLE : /etc/ssl/certs/ca-certificates.crt
101+ PIP_EXTRA_INDEX_URL : https://download.pytorch.org/whl/cpu
102+ TORCH_CPU_ONLY : " true"
103+
104+ steps :
105+ - name : Checkout repository
106+ uses : actions/checkout@v4
107+
108+ - name : Install Act dependencies
109+ if : ${{ env.ACT }}
110+ run : |
111+ if ! command -v apt-get &> /dev/null; then
112+ echo "apt-get not found, cannot proceed"
113+ exit 1
114+ fi
115+ DEBIAN_FRONTEND=noninteractive apt-get update && \
116+ DEBIAN_FRONTEND=noninteractive apt-get install -y apt-utils sudo
117+
118+ - name : Install Runner Dependencies & Configure CA
119+ run : |
120+ sudo apt-get update
121+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y lsb-release nodejs ca-certificates
122+ sudo update-ca-certificates
123+
124+ - name : Set up Python
125+ uses : actions/setup-python@v5
126+ with :
127+ python-version : ' 3.12.3'
128+ cache : ' pip'
129+
130+ - name : Install dependencies
131+ run : |
132+ pip install --upgrade pip setuptools wheel
133+ pip install .[docs]
134+
135+ - name : Verify PyTorch installation
136+ run : |
137+ python -c "import torch; print(f'PyTorch version: {torch.__version__}'); print(f'CUDA available: {torch.cuda.is_available()}')"
138+
139+ - name : Build documentation
140+ run : sphinx-build -b html -D html_baseurl="" docs/source docs/build
141+
142+ - name : Upload artifact for Gitea
143+ uses : actions/upload-artifact@v3
97144 with :
98145 name : docs-artifact
99146 path : ./docs/build
100147
101148 # Deploy job for GitHub Pages
102149 deploy-github :
103- needs : build
150+ needs : build-github
104151 if : ${{ github.server_url == 'https://github.com' }}
105152 environment :
106153 name : github-pages
@@ -128,7 +175,7 @@ jobs:
128175
129176 # Deploy job for Gitea
130177 deploy-gitea :
131- needs : build
178+ needs : build-gitea
132179 if : ${{ github.server_url != 'https://github.com' }}
133180 runs-on : ubuntu-latest
134181 env :
0 commit comments