Refactor current CI workflow into composable jobs

pull/769/head
Clément Fournier 2022-04-04 11:13:29 +01:00 committed by powderluv
parent 2a0c567418
commit 37087ccd5f
2 changed files with 32 additions and 24 deletions

View File

@ -0,0 +1,28 @@
name: "Setup build environment"
description: "Setup the build environment. An action so that it can be shared between in-tree/out-of-tree jobs"
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install MLIR Python depends
run: |
python -m pip install -r $GITHUB_WORKSPACE/externals/llvm-project/mlir/python/requirements.txt
shell: bash
- name: Install PyTorch nightly depends
run: |
python -m pip install -r requirements.txt
shell: bash
- name: Install Ninja
uses: llvm/actions/install-ninja@55d844821959226fab4911f96f37071c1d4c3268
- name: Get Submodule Hash
id: get-submodule-hash
run: echo "::set-output name=hash::$(md5sum $(git submodule status))"
shell: bash
- name: Ccache for C++ compilation
uses: hendrikmuhs/ccache-action@4687d037e4d7cf725512d9b819137a3af34d39b3
with:
key: ${{ runner.os }}-clangreleaseasserts-${{ steps.get-submodule-hash.outputs.hash }}

View File

@ -19,30 +19,11 @@ jobs:
name: Build and Test (Release Asserts)
runs-on: ubuntu-20.04
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Get torch-mlir
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Install MLIR Python depends
run: |
python -m pip install -r $GITHUB_WORKSPACE/externals/llvm-project/mlir/python/requirements.txt
- name: Install PyTorch nightly depends
run: |
python -m pip install -r requirements.txt
- name: Install Ninja
uses: llvm/actions/install-ninja@55d844821959226fab4911f96f37071c1d4c3268
- name: Get Submodule Hash
id: get-submodule-hash
run: echo "::set-output name=hash::$(md5sum $(git submodule status))"
shell: bash
- name: Ccache for C++ compilation
uses: hendrikmuhs/ccache-action@4687d037e4d7cf725512d9b819137a3af34d39b3
with:
key: ${{ runner.os }}-clangreleaseasserts-${{ steps.get-submodule-hash.outputs.hash }}
- uses: ./.github/actions/setup-build
- name: Build and Test torch-mlir (Assert)
run: |
cd $GITHUB_WORKSPACE
@ -85,11 +66,10 @@ jobs:
TORCH_MLIR_PYTHON_PACKAGE_VERSION="${{ github.event.inputs.python_package_version }}" \
./build_tools/build_python_wheels.sh
# If we were given a release_id, then upload the package we just built
# to the github releases page.
# upload the package we just built to the github releases page.
- name: Upload Release Assets (if requested)
if: github.event.inputs.release_id != ''
id: upload-release-assets
if: github.event.inputs.release_id != ''
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
@ -99,8 +79,8 @@ jobs:
# Publishing is necessary to make the release visible to `pip`
# on the github releases page.
- name: Publish Release (if requested)
if: github.event.inputs.release_id != ''
id: publish_release
if: github.event.inputs.release_id != ''
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}