2022-04-26 03:33:15 +08:00
|
|
|
name: Bazel Build and Test
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-08-12 07:35:15 +08:00
|
|
|
branches: [ main ]
|
2022-08-10 04:28:21 +08:00
|
|
|
workflow_dispatch:
|
2022-04-26 03:33:15 +08:00
|
|
|
|
2022-08-13 08:38:48 +08:00
|
|
|
# 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
|
|
|
|
|
|
|
|
|
2022-04-26 03:33:15 +08:00
|
|
|
jobs:
|
2022-08-12 07:35:15 +08:00
|
|
|
ubuntu-build:
|
|
|
|
name: ubuntu-x86_64
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
|
2022-04-26 03:33:15 +08:00
|
|
|
steps:
|
2022-08-12 07:35:15 +08:00
|
|
|
- name: Checkout torch-mlir
|
2022-08-18 03:46:17 +08:00
|
|
|
uses: actions/checkout@v3
|
2022-04-26 03:33:15 +08:00
|
|
|
with:
|
|
|
|
submodules: 'true'
|
2022-08-12 07:35:15 +08:00
|
|
|
|
2022-08-18 03:46:17 +08:00
|
|
|
- name: Setup cache for bazel
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ~/.cache/bazel
|
|
|
|
key: ubuntu_x86_64_torch_mlir_bazel_build_cache
|
|
|
|
|
|
|
|
- name: Set bazel cache permissions
|
|
|
|
run: |
|
|
|
|
sudo chown -R root:root "${HOME}/.cache/bazel"
|
|
|
|
|
|
|
|
- name: Build docker image
|
|
|
|
run: |
|
|
|
|
docker build -f utils/bazel/docker/Dockerfile \
|
|
|
|
-t torch-mlir:ci \
|
|
|
|
.
|
|
|
|
|
|
|
|
- name: Bazel build torch-mlir
|
|
|
|
run: |
|
|
|
|
docker run --rm \
|
|
|
|
-v "$(pwd)":"/opt/src/torch-mlir" \
|
|
|
|
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \
|
|
|
|
torch-mlir:ci \
|
|
|
|
./utils/bazel/docker/run_bazel_build.sh
|
|
|
|
|
|
|
|
- name: Switch bazel cache permissions
|
2022-04-26 03:33:15 +08:00
|
|
|
run: |
|
2022-08-18 03:46:17 +08:00
|
|
|
sudo chown -R "$USER":"$USER" "${HOME}/.cache/bazel"
|
2022-08-12 07:35:15 +08:00
|
|
|
|
2022-04-26 03:33:15 +08:00
|
|
|
- name: Send mail
|
|
|
|
if: failure()
|
|
|
|
uses: dawidd6/action-send-mail@v3
|
|
|
|
with:
|
|
|
|
server_address: ${{ secrets.SMTP_SERVER }}
|
|
|
|
server_port: ${{ secrets.SMTP_PORT }}
|
|
|
|
username: ${{ secrets.SMTP_USERNAME }}
|
|
|
|
password: ${{ secrets.SMTP_PASSWORD }}
|
|
|
|
subject: GitHub Action Bazel Build and Test failed!
|
|
|
|
body: Bazel Build job failed! See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} for more information.
|
|
|
|
to: ${{ secrets.MAIL_RECEIVER }}
|
|
|
|
from: Torch-MLIR Bazel Build GitHub Actions
|