Skip to content

github pages

github pages #14290

Workflow file for this run

name: github pages
on:
push:
branches:
- main
schedule:
# Always regenerate once every 4 hour
- cron: '15 */4 * * *'
pull_request:
workflow_dispatch:
jobs:
build-deploy:
# This ensures that the `GITHUB_TOKEN` set in this GitHub Action job
# has sufficient privileges to write to a secondary branch. On older
# repositories, the `GITHUB_TOKEN` used to have lots of privileges,
# but this needs to now be set explicitly. After setting this, people
# can just fork `mlir-www` and having a working deploy to the
# `gh-pages` branch.
permissions:
contents: write
runs-on: ubuntu-22.04
steps:
- name: Timestamp Begin
run: date
- uses: actions/checkout@v6
- name: Print mlir-www-helper --help
run: ./mlir-www-helper.sh --help
- name: Install dependencies
run: |
sudo apt-get install graphviz python3
wget https://github.com/doxygen/doxygen/releases/download/Release_1_14_0/doxygen-1.14.0.linux.bin.tar.gz -O /tmp/doxygen.tar.gz
tar -xvf /tmp/doxygen.tar.gz
echo "$(pwd)/doxygen-1.14.0/bin" >> $GITHUB_PATH
- name: Clone LLVM repo
uses: actions/checkout@v6
with:
repository: llvm/llvm-project
ref: 'main'
path: 'llvm_src'
- name: Ccache for C++ compilation
uses: hendrikmuhs/ccache-action@v1.2.20
- name: Build MLIR Dialect docs & doxygen src
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
mkdir llvm_src/build
cd llvm_src/build
pip install -r ../mlir/python/requirements.txt
# Assert mode is needed for the pattern search index
cmake ../llvm -GNinja \
-DLLVM_CCACHE_BUILD=ON \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_TARGETS_TO_BUILD="host" \
-DMLIR_INCLUDE_DOCS="true" \
-DLLVM_ENABLE_DOXYGEN="true" \
-DMLIR_ENABLE_BINDINGS_PYTHON=ON
ninja -j$(nproc) mlir-doc doxygen-mlir MLIRPythonModules
echo "PYTHONPATH=$(pwd)/tools/mlir/python_packages/mlir_core" >> $GITHUB_ENV
- name: Install docs
run: ./mlir-www-helper.sh --install-docs "llvm_src" "website"
- name: Install python bindings docs
run: |
cd sphinx-mlir-python
pip install -r requirements.txt
SPHINX_LLVM_SRC_PATH=$(pwd)/../llvm_src make html
cp -r _build/html ../website/static/python-bindings
- name: Build pattern search index
run: |
cd llvm_src/build
# Run the tests once to ensure they are passing.
# The next run used to generate the patterns log is disabling error checking. This first
# run will ensure we don't generate the website when tests are broken.
ninja -j$(nproc) check-mlir
echo "finished building tests"
# ignore nonzero exit codes in this command, since MLIR_GENERATE_PATTERN_CATALOG
# implicitly enables`--mlir-disable-threading` which some tests are incompatible with.
{ MLIR_GENERATE_PATTERN_CATALOG=1 bin/llvm-lit -j$(nproc) -v -a tools/mlir/test || true ; } \
| grep '# | \[pattern-logging-listener' \
| sed 's/# | \[pattern-logging-listener PatternLoggingListener.cpp:[0-9]* [0-9]*] //g' \
| sort | uniq > $HOME/pattern_catalog.txt
# back to mlir-www root
cd ../..
head $HOME/pattern_catalog.txt
python3 build_pattern_catalog_index.py $HOME/pattern_catalog.txt website/static/pattern-search/pattern-index.json
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.119.0'
extended: false
- name: Build Website
run: |
cd website
hugo --minify -d ../public
echo -n mlir.llvm.org > ../public/CNAME
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./public
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
- name: Timestamp End
run: date