Add pre-push hook (#2997) #2505
This file contains hidden or 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
| name: Generate GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| # pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build-docs: | |
| name: Generate Documentation | |
| runs-on: ubuntu-latest | |
| # Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Configure Environment | |
| run: echo "$GITHUB_WORKSPACE/llvm/install/bin" >> $GITHUB_PATH | |
| # Clone the repo and its submodules. Do shallow clone to save clone | |
| # time. | |
| - name: Get the project repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| submodules: "true" | |
| - name: Install packages | |
| run: sudo apt-get install -y graphviz lld doxygen | |
| - name: Install Python packages | |
| run: | | |
| pip install --upgrade pip | |
| python utils/mlir_aie_wheels/vendor_eudsl.py \ | |
| --requirements python/requirements.txt \ | |
| --install-non-eudsl | |
| pip install -r python/requirements_dev.txt | |
| - name: Install Ninja | |
| # https://github.com/llvm/actions/tree/main/install-ninja | |
| uses: llvm/actions/install-ninja@6a57890d0e3f9f35dfc72e7e48bc5e1e527cdd6c | |
| - name: Get Submodule Hash | |
| id: get-submodule-hash | |
| run: echo "hash=$(md5sum $(echo utils/clone-llvm.sh))" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Ccache for C++ compilation | |
| # https://github.com/hendrikmuhs/ccache-action/releases/tag/v1.2.9 | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| key: ${{ runner.os }}-releaseasserts-${{ steps.get-submodule-hash.outputs.hash }} | |
| max-size: 1G | |
| - name: Get cmakeModules | |
| id: clone-cmakeModules | |
| run: git clone --depth 1 https://github.com/Xilinx/cmakeModules.git | |
| shell: bash | |
| - name: Get MLIR | |
| id: mlir-wheels | |
| run: | | |
| VERSION=$(utils/clone-llvm.sh --get-wheel-version) | |
| pip -q download mlir==$VERSION \ | |
| -f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/mlir-distro | |
| unzip -q mlir-*.whl | |
| WHL=$(ls mlir-*.whl) | |
| echo "MLIR_WHEEL_VERSION=$VERSION" | tee -a $GITHUB_OUTPUT | |
| echo "MLIR_DIR=$PWD/mlir" | tee -a $GITHUB_OUTPUT | |
| # Build the repo test target in release mode to build and test. | |
| - name: Build Docs | |
| run: | | |
| mkdir build_release | |
| pushd build_release | |
| cmake .. \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DLLVM_ENABLE_ASSERTIONS=OFF \ | |
| -DCMAKE_MODULE_PATH=$PWD/../cmake/modulesXilinx \ | |
| -DMLIR_DIR=$PWD/../mlir/lib/cmake/mlir \ | |
| -DLLVM_DIR=$PWD/../mlir/lib/cmake/llvm \ | |
| -DLLVM_USE_LINKER=lld \ | |
| -DAIE_INCLUDE_DOCS=ON \ | |
| -DAIE_ENABLE_PYTHON_PASSES=OFF \ | |
| -DLLVM_EXTERNAL_LIT=$(which lit) | |
| make docs | |
| popd | |
| pushd python | |
| doxygen | |
| popd | |
| cp -r docs/* build_release/docs | |
| dot -Tpng docs/dialects.dot > build_release/docs/dialects.png | |
| dot -Tsvg docs/dialects.dot > build_release/docs/dialects.svg | |
| - name: Save MLIR Version | |
| run: | | |
| echo "{" > build_release/docs/build_info.json | |
| echo "llvm-version: \"${{ steps.mlir-wheels.outputs.MLIR_WHEEL_VERSION }}\"," >> build_release/docs/build_info.json | |
| echo "}" > build_release/docs/build_info.json | |
| - name: test | |
| run: | | |
| find ./build_release/docs | |
| - name: Publish to GitHub-Pages | |
| if: github.event_name != 'pull_request' | |
| # https://github.com/peaceiris/actions-gh-pages/releases/tag/v3.9.3 | |
| uses: peaceiris/actions-gh-pages@v3.9.3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./build_release/docs | |
| enable_jekyll: true |