[CI][docs] Fix docs CI #51
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright Allo authors. All Rights Reserved. | |
# SPDX-License-Identifier: Apache-2.0 | |
name: "Build documentation" | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/**' | |
- 'docs/**' | |
- 'tutorials/**' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/**' | |
- 'docs/**' | |
- 'tutorials/**' | |
permissions: | |
contents: write | |
jobs: | |
build: | |
# This job runs on Linux | |
runs-on: ubuntu-latest | |
container: | |
image: chhzh123/hcl-dialect:llvm-18.x-py3.12 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 | |
# - name: Patch LLVM Project | |
# run: | | |
# cp externals/llvm_patch /root/llvm-project | |
# cd /root/llvm-project | |
# git apply llvm_patch | |
- name: Build HCL-MLIR | |
shell: bash | |
run: | | |
source activate hcl-dev | |
export SUBMOD_COMMIT=$(git rev-parse HEAD:externals/hcl_mlir) | |
cd /root/hcl-dialect | |
git remote update | |
git fetch | |
git checkout $SUBMOD_COMMIT | |
cd build | |
make -j4 | |
cd tools/hcl/python_packages/hcl_core | |
python3 -m pip install -e . | |
- name: Build docs | |
shell: bash | |
run: | | |
source activate hcl-dev | |
export ALLO_HOME=$(pwd) | |
export LLVM_BUILD_DIR=/root/llvm-project/build | |
export PATH=${LLVM_BUILD_DIR}/bin:${PATH} | |
export PYTHONPATH=$ALLO_HOME:${PYTHONPATH} | |
export PYTHONPATH=/root/hcl-dialect/build/tools/hcl/python_packages/hcl_core:${PYTHONPATH} | |
python3 -m pip install -r requirements.txt | |
cd docs | |
python3 -m pip install -r requirements.txt | |
make html | |
# Create an artifact of the html output using Github action: https://github.com/actions/upload-artifact | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: DocumentationHTML | |
path: docs/build/html/ | |
- name: Install rsync | |
shell: bash | |
run: | | |
apt-get update && apt-get install -y rsync | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Deploy docs | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
# https://github.com/JamesIves/github-pages-deploy-action/issues/1179#issuecomment-1209272847 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: docs/build/html | |
git-config-name: chhzh123 | |
git-config-email: hc676@cornell.edu | |
- run: touch docs/build/html/.nojekyll | |
- name: Deploy docs to website | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} | |
with: | |
source-directory: 'docs/build/html' | |
destination-github-username: 'chhzh123' | |
destination-repository-name: 'allo-docs' | |
user-email: hc676@cornell.edu | |
target-branch: gh-pages | |
target-directory: "" |