| # 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 IREE. It is designed to be called from a parent workflow. | |
| # The concurrency of this workflow is controlled by the caller's job. | |
| name: Build All | |
| on: | |
| workflow_call: | |
| inputs: | |
| runner-group: | |
| required: true | |
| type: string | |
| runner-env: | |
| required: true | |
| type: string | |
| write-caches: | |
| required: true | |
| type: string | |
| outputs: | |
| install-dir: | |
| description: Local install directory path. | |
| value: ${{ jobs.build_all.outputs.install-dir }} | |
| install-dir-archive: | |
| description: Name of the zipped install directory. | |
| value: ${{ jobs.build_all.outputs.install-dir-archive }} | |
| install-dir-gcs-artifact: | |
| description: GCS path to the uploaded install archive. | |
| value: ${{ jobs.build_all.outputs.install-dir-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_all: | |
| runs-on: | |
| - self-hosted # must come first | |
| - runner-group=${{ inputs.runner-group }} | |
| - environment=${{ inputs.runner-env }} | |
| - cpu | |
| - os-family=Linux | |
| env: | |
| BUILD_DIR: full-build-dir | |
| INSTALL_DIR: full-build-dir/install | |
| outputs: | |
| install-dir: ${{ env.INSTALL_DIR }} | |
| # Pass the install directory as output for other jobs to use. | |
| # TODO(#16203): replace this with iree-dist packages | |
| # The install directory provides a similar set of files and existing | |
| # jobs are already configured to use the build directory, so this is | |
| # an intermediate step towards a fully package-based CI setup. | |
| install-dir-archive: ${{ steps.install-archive.outputs.install-dir-archive }} | |
| install-dir-gcs-artifact: ${{ steps.install-upload.outputs.install-dir-gcs-artifact }} | |
| steps: | |
| - name: "Checking out repository" | |
| uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
| with: | |
| submodules: true | |
| - name: "Building IREE" | |
| env: | |
| IREE_WRITE_REMOTE_CCACHE: ${{ inputs.write-caches }} | |
| run: | | |
| ./build_tools/github_actions/docker_run.sh \ | |
| --env "IREE_CCACHE_GCP_TOKEN=$(gcloud auth application-default print-access-token)" \ | |
| --env "IREE_WRITE_REMOTE_CCACHE=${IREE_WRITE_REMOTE_CCACHE}" \ | |
| --env "CCACHE_NAMESPACE=gcr.io/iree-oss/base@sha256:dc314b4fe30fc1315742512891357bffed4d1b62ffcb46258b1e0761c737b446" \ | |
| --env "IREE_BUILD_SETUP_PYTHON_VENV=${BUILD_DIR}/.venv" \ | |
| gcr.io/iree-oss/base@sha256:dc314b4fe30fc1315742512891357bffed4d1b62ffcb46258b1e0761c737b446 \ | |
| ./build_tools/cmake/build_all.sh "${BUILD_DIR}" | |
| # TODO(scotttodd): trim build/tests to exclude integration tests (tests/ folder, check tests) | |
| # that coverage should move to a test_cpu job (matrix with test_gpu?) | |
| - name: "Testing IREE" | |
| run: | | |
| ./build_tools/github_actions/docker_run.sh \ | |
| gcr.io/iree-oss/base@sha256:dc314b4fe30fc1315742512891357bffed4d1b62ffcb46258b1e0761c737b446 \ | |
| ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" | |
| - name: "Testing iree-dialects" | |
| run: | | |
| ./build_tools/github_actions/docker_run.sh \ | |
| gcr.io/iree-oss/base@sha256:dc314b4fe30fc1315742512891357bffed4d1b62ffcb46258b1e0761c737b446 \ | |
| ./build_tools/cmake/test_iree_dialects.sh "${BUILD_DIR}" | |
| # TODO(#16203): If this (or iree-dist) is small enough, just use GitHub | |
| # artifacts instead of `tar` commands and GCS | |
| - name: "Creating install dir archive" | |
| id: install-archive | |
| env: | |
| INSTALL_DIR_ARCHIVE: install_dir.tar.zst | |
| run: | | |
| tar -I 'zstd -T0' \ | |
| -cf ${INSTALL_DIR_ARCHIVE} ${INSTALL_DIR} | |
| echo "install-dir-archive=${INSTALL_DIR_ARCHIVE}" >> "${GITHUB_OUTPUT}" | |
| - name: "Uploading install dir archive" | |
| id: install-upload | |
| env: | |
| INSTALL_DIR_ARCHIVE: ${{ steps.install-archive.outputs.install-dir-archive }} | |
| INSTALL_DIR_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.install-archive.outputs.install-dir-archive }} | |
| run: | | |
| gcloud storage cp "${INSTALL_DIR_ARCHIVE}" "${INSTALL_DIR_GCS_ARTIFACT}" | |
| echo "install-dir-gcs-artifact=${INSTALL_DIR_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" |