| # Copyright 2022 The IREE Authors |
| # |
| # 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 |
| |
| on: |
| workflow_call: |
| inputs: |
| host-binary-root: |
| required: true |
| type: string |
| enable-assertions: |
| required: false |
| type: string # Thanks CMake and Bash for not having proper booleans |
| default: "OFF" |
| |
| jobs: |
| host_tools: |
| runs-on: |
| # self-hosted has to be listed first. See |
| # https://docs.github.com/en/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow |
| - self-hosted |
| # Have to do a weird hack to get a pseudo-ternary operator. See |
| # https://github.com/actions/runner/issues/409. Also note that |
| # `github.event_name` for workflow_call is the name of the calling event, |
| # which is poorly documented, but useful for us here. See |
| # https://github.com/github/docs/issues/16515 |
| - runner-group=${{ github.event_name == 'pull_request' && 'presubmit' || 'postsubmit' }} |
| - cpu |
| - os-family=Linux |
| env: |
| HOST_BINARY_ROOT: ${{ inputs.host-binary-root }} |
| HOST_BINARY_ARCHIVE: ${{ inputs.host-binary-root }}.tar |
| steps: |
| - name: "Checking out repository" |
| uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2 |
| with: |
| submodules: true |
| - name: "Building host tools" |
| run: | |
| ./build_tools/github_actions/docker_run.sh \ |
| --env "INSTALL_DIR=${HOST_BINARY_ROOT}" \ |
| gcr.io/iree-oss/base@sha256:9d742e01507c292def852cbfebfae71412cff94df0ab2619f61f9a5a2a98f651 \ |
| ./build_tools/cmake/build_host_tools.sh |
| # Using a tar archive is necessary to preserve file permissions. See |
| # https://github.com/actions/upload-artifact#maintaining-file-permissions-and-case-sensitive-files |
| # The upload action already does its own gzip compression, so it's likely |
| # unnecessary (and perhaps harmful) to do our own, though that hasn't been |
| # investigated. |
| - name: "Creating host tools archive" |
| run: tar -cvf "${HOST_BINARY_ARCHIVE}" "${HOST_BINARY_ROOT}" |
| - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 |
| with: |
| name: "${{ env.HOST_BINARY_ARCHIVE }}" |
| path: "${{ env.HOST_BINARY_ARCHIVE }}" |