| # 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 |
| # |
| # Workflow for building Tensorflow binaries. |
| # It is designed to be called from a parent workflow. |
| # The concurrency of this workflow is controlled by the caller's job. |
| |
| name: Build Tensorflow Integrations |
| |
| on: |
| workflow_call: |
| inputs: |
| runner-group: |
| required: true |
| type: string |
| runner-env: |
| required: true |
| type: string |
| write-caches: |
| required: true |
| type: string |
| outputs: |
| binaries-dir: |
| description: | |
| Local path that stores compiled Tensorflow binaries. |
| value: ${{ jobs.build_tf_integrations.outputs.binaries-dir }} |
| binaries-archive: |
| description: | |
| Local path to the zipped binary directory. |
| value: ${{ jobs.build_tf_integrations.outputs.binaries-archive }} |
| binaries-gcs-artifact: |
| description: | |
| GCS path to the uploaded binary archive. |
| value: ${{ jobs.build_tf_integrations.outputs.binaries-gcs-artifact }} |
| |
| env: |
| # This duplicates the variable from ci.yml. The variable needs to be in env |
| # instead of the outputs of setup because it contains the run attempt and we |
| # want that to be the current attempt, not whatever attempt the setup step |
| # last ran in. It therefore can't be passed in via inputs because the env |
| # context isn't available there. |
| GCS_DIR: gs://iree-github-actions-${{ github.event_name == 'pull_request' && 'presubmit' || 'postsubmit' }}-artifacts/${{ github.run_id }}/${{ github.run_attempt }} |
| |
| jobs: |
| build_tf_integrations: |
| runs-on: |
| - self-hosted # must come first |
| - runner-group=${{ inputs.runner-group }} |
| - environment=${{ inputs.runner-env }} |
| - cpu |
| - os-family=Linux |
| outputs: |
| binaries-dir: ${{ steps.build.outputs.binaries-dir }} |
| binaries-archive: ${{ steps.archive.outputs.binaries-archive }} |
| binaries-gcs-artifact: ${{ steps.upload.outputs.binaries-gcs-artifact }} |
| steps: |
| - name: "Checking out repository" |
| uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 |
| with: |
| submodules: true |
| - name: "Building TF binaries" |
| id: build |
| env: |
| IREE_TF_BINARIES_OUTPUT_DIR: iree-tf-binaries |
| IREE_WRITE_REMOTE_BAZEL_CACHE: ${{ inputs.write-caches }} |
| run: | |
| ./build_tools/github_actions/docker_run.sh \ |
| --env "IREE_WRITE_REMOTE_BAZEL_CACHE=${IREE_WRITE_REMOTE_BAZEL_CACHE}" \ |
| --env "IREE_TF_BINARIES_OUTPUT_DIR=${IREE_TF_BINARIES_OUTPUT_DIR}" \ |
| gcr.io/iree-oss/frontends-swiftshader@sha256:d9448f2760b1de0dfe4a1a1d46b7ef72f0430f5937d0164f43400fdf3f811abc \ |
| build_tools/cmake/build_tf_binaries.sh |
| echo "binaries-dir=${IREE_TF_BINARIES_OUTPUT_DIR}" >> "${GITHUB_OUTPUT}" |
| - name: "Creating archive of binaries" |
| id: archive |
| env: |
| BINARIES_ARCHIVE: tf-binaries.tar |
| BINARIES_DIR: ${{ steps.build.outputs.binaries-dir }} |
| run: | |
| tar -cf "${BINARIES_ARCHIVE}" "${BINARIES_DIR}" |
| echo "binaries-archive=${BINARIES_ARCHIVE}" >> "${GITHUB_OUTPUT}" |
| - name: "Uploading binaries archive" |
| id: upload |
| env: |
| BINARIES_ARCHIVE: ${{ steps.archive.outputs.binaries-archive }} |
| BINARIES_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.archive.outputs.binaries-archive }} |
| run: | |
| gcloud storage cp "${BINARIES_ARCHIVE}" "${BINARIES_GCS_ARTIFACT}" |
| echo "binaries-gcs-artifact=${BINARIES_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" |