Skip to content

ci: fix comparison types in workflow #7447

ci: fix comparison types in workflow

ci: fix comparison types in workflow #7447

Workflow file for this run

name: Build website, deploy to GH pages if on main
permissions: read-all
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
check-cache:
runs-on:
labels: ubuntu-22.04-8core
outputs:
runner: ${{ steps.runner.outputs.runner }}
steps:
- name: Check out repository code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # pin@v3
- name: Cache bazel build artifacts
id: cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # [email protected]
with:
path: |
~/.cache/bazel
key: ${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
restore-keys: |
${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
lookup-only: true
- name: Select runner
id: runner
env:
CACHE_HIT: ${{ steps.cache.outputs.cache-hit == 'true' }}
run: |
set -euo pipefail
if [[ "${CACHE_HIT}" == "true" ]]; then
echo "runner=ubuntu-22.04-8core" >> "$GITHUB_OUTPUT"
else
echo "runner=ubuntu-22.04-32core" >> "$GITHUB_OUTPUT"
fi
build-and-deploy:
needs: check-cache
runs-on:
labels: ${{ needs.check-cache.outputs.runner }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # pin@v3
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Cache bazel build artifacts
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # [email protected]
with:
path: |
~/.cache/bazel
key: ${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }}
restore-keys: |
${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-
# This requires building mlir-tblgen, but may not require a full llvm build
# as a result. It results in the files being added to their respective
# locations (relative to each *_inc_gen target) under bazel-bin. Note the
# _filegroup suffix is required to actually write the markdown files to
# disk.
- name: "Build markdown files from tblgen sources"
run: |
bazel query "filter('_filegroup', siblings(kind('gentbl_rule', @heir//...)))" | \
xargs bazel build --//:enable_openmp=0 "$@"
- name: "Copy markdown files to docs/"
run: |
python -m pip install --upgrade pip
python -m pip install pyyaml==6.0.2 fire==0.7.0
# heir-opt is needed to generate the doctest examples
bazel build --//:enable_openmp=0 //tools:heir-opt
python -m scripts.docs.copy_tblgen_files
# Please update the local install instructions at docs/README.md if
# changing hugo version
- name: Setup Hugo
uses: peaceiris/actions-hugo@16361eb4acea8698b220b76c0d4e84e1fd22c61d # [email protected]
with:
hugo-version: '0.113.0'
extended: true
# Please update the local install instructions at docs/README.md if
# changing node version
- name: Setup Node
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: '18'
cache: 'npm'
# The action defaults to search for the dependency file (package-lock.json,
# npm-shrinkwrap.json or yarn.lock) in the repository root, and uses its
# hash as a part of the cache key.
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data
cache-dependency-path: '**/package-lock.json'
- name: Install Docsy dependencies
working-directory: ./docs
run: npm ci
- name: Build
working-directory: ./docs
run: hugo --minify
- name: Copy CNAME to hugo public dir
working-directory: ./docs
run: cp CNAME public/CNAME
- name: Deploy
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # [email protected]
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/public