[NFC] Create include/mlir-tcp
and move headers over
#46
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
# Licensed under the Apache License v2.0 with LLVM Exceptions. | |
# See https://llvm.org/LICENSE.txt for license information. | |
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |
# Also available under a BSD-style license. See LICENSE. | |
name: Bazel Build and Test (mlir-tcp) | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
# Ensure that only a single job or workflow using the same | |
# concurrency group will run at a time. This would cancel | |
# any in-progress jobs in the same github workflow and github | |
# ref (e.g. refs/heads/main or refs/pull/<pr_number>/merge). | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
ubuntu-build: | |
name: ubuntu-x86_64 / mlir-tcp | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout mlir-tcp | |
uses: actions/checkout@v3 | |
# Continually update cache even if there's a "hit" during | |
# restore to avoid the cache going stale over time | |
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache | |
- name: Setup cache for bazel | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/bazel | |
key: mlir-tcp-bazel-build-cache-${{ runner.os }}-${{ github.sha }} | |
restore-keys: | | |
mlir-tcp-bazel-build-cache-${{ runner.os }} | |
# Change bazel cache directory to root ownership | |
# to allow writing to it from within the docker container. | |
# If no cache hits, this directory is not present | |
# so don't run chown (will error otherwise). | |
- name: Set bazel cache permissions | |
run: | | |
if [ -d "${HOME}/.cache/bazel" ]; then | |
sudo chown -R root:root "${HOME}/.cache/bazel" | |
fi | |
- name: Build docker image | |
run: | | |
docker build -f docker/Dockerfile \ | |
-t mlir-tcp:ci \ | |
. | |
- name: Verify clang-format was run (cpp lint) | |
run: | | |
docker run --rm \ | |
-v "$(pwd)":"/opt/src/mlir-tcp" \ | |
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \ | |
mlir-tcp:ci \ | |
find . -type f -name "*.cpp" -o -name "*.h" | xargs clang-format -i | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "Please run clang-format 'find . -type f -name "*.cpp" -o -name "*.h" | xargs clang-format -i' and commit changes." | |
exit 1 | |
fi | |
- name: Verify buildifier was run (bazel lint) | |
run: | | |
docker run --rm \ | |
-v "$(pwd)":"/opt/src/mlir-tcp" \ | |
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \ | |
mlir-tcp:ci \ | |
bazel run --config=clang_linux //:buildifier | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "Please 'bazel run //:buildifier' and commit changes." | |
exit 1 | |
fi | |
- name: Bazel build mlir-tcp | |
run: | | |
docker run --rm \ | |
-v "$(pwd)":"/opt/src/mlir-tcp" \ | |
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \ | |
mlir-tcp:ci \ | |
bazel build --config=clang_linux //:tcp-opt | |
- name: Bazel test mlir-tcp (lit tests, aot compile tests) | |
run: | | |
docker run --rm \ | |
-v "$(pwd)":"/opt/src/mlir-tcp" \ | |
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \ | |
mlir-tcp:ci \ | |
bazel test --config=clang_linux //test/... | |
# Switch back bazel cache directory to user ownership | |
# to allow GHA post-cache step to save cache without | |
# permissions issue. | |
- name: Switch bazel cache permissions | |
run: | | |
if [ -d "${HOME}/.cache/bazel" ]; then | |
sudo chown -R "$USER":"$USER" "${HOME}/.cache/bazel" | |
fi |