From 37087ccd5fd908cf6879378ef3f1f030bc0a89c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 4 Apr 2022 11:13:29 +0100 Subject: [PATCH] Refactor current CI workflow into composable jobs --- .github/actions/setup-build/action.yml | 28 ++++++++++++++++++++++++++ .github/workflows/buildAndTest.yml | 28 ++++---------------------- 2 files changed, 32 insertions(+), 24 deletions(-) create mode 100644 .github/actions/setup-build/action.yml diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml new file mode 100644 index 000000000..fe7df05ce --- /dev/null +++ b/.github/actions/setup-build/action.yml @@ -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 }} diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml index e60b02c20..e9b2ae81a 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/buildAndTest.yml @@ -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 }}