Set CC and CXX environment variables using 'env' in workflows. (#18425)
Follow-up to
https://github.com/iree-org/iree/pull/18422#discussion_r1742752372 and
https://github.com/iree-org/iree/pull/18421#discussion_r1742758455.
This style is more compact, but it does remove some context that could
be useful - that the CC/CXX environment variables are for the build
toolchain and are related to CMake and Ninja.
The 'runtime' workflow is cross platform and also sets this
conditionally:
https://github.com/iree-org/iree/blob/1124be8025995b64804e9f02b62a0354b25dfb2b/.github/workflows/ci.yml#L112-L124
See
https://github.com/iree-org/iree-template-runtime-cmake/blob/main/.github/workflows/build-and-test.yml
for a more comprehensive example where we also branch on gcc and clang
in the same matrix.
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8110e53..733cab7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -156,14 +156,12 @@
runs-on: ubuntu-20.04
env:
BUILD_DIR: build-runtime
+ CC: clang
+ CXX: clang++
steps:
- uses: actions/checkout@v4.1.7
- name: Install requirements
- run: |
- sudo apt update
- sudo apt install -y ninja-build
- echo "CC=clang" >> $GITHUB_ENV
- echo "CXX=clang++" >> $GITHUB_ENV
+ run: sudo apt update && sudo apt install -y ninja-build
- name: Checkout runtime submodules
run: bash ./build_tools/scripts/git/update_runtime_submodules.sh
- name: ccache
@@ -200,15 +198,13 @@
- provider: console
env:
BUILD_DIR: build-tracing
+ CC: clang
+ CXX: clang++
TRACING_PROVIDER: ${{ matrix.provider }}
steps:
- uses: actions/checkout@v4.1.7
- name: Install requirements
- run: |
- sudo apt update
- sudo apt install -y ninja-build
- echo "CC=clang" >> $GITHUB_ENV
- echo "CXX=clang++" >> $GITHUB_ENV
+ run: sudo apt update && sudo apt install -y ninja-build
- name: Checkout runtime submodules
run: bash ./build_tools/scripts/git/update_runtime_submodules.sh
- name: ccache
diff --git a/.github/workflows/pkgci_test_amd_mi250.yml b/.github/workflows/pkgci_test_amd_mi250.yml
index 197ddc1..35ee559 100644
--- a/.github/workflows/pkgci_test_amd_mi250.yml
+++ b/.github/workflows/pkgci_test_amd_mi250.yml
@@ -24,6 +24,8 @@
PACKAGE_DOWNLOAD_DIR: ${{ github.workspace }}/.packages
BUILD_DIR: build-tests
VENV_DIR: ${{ github.workspace }}/.venv
+ CC: clang
+ CXX: clang++
IREE_CPU_DISABLE: 1
IREE_VULKAN_DISABLE: 1
IREE_CUDA_DISABLE: 1
@@ -49,10 +51,6 @@
./build_tools/pkgci/setup_venv.py ${VENV_DIR} \
--artifact-path=${PACKAGE_DOWNLOAD_DIR} \
--fetch-gh-workflow=${{ inputs.artifact_run_id }}
- - name: Configure build toolchain
- run: |
- echo "CC=clang" >> $GITHUB_ENV
- echo "CXX=clang++" >> $GITHUB_ENV
- name: Build tests
run: ./build_tools/pkgci/build_tests_using_package.sh ${VENV_DIR}/bin
diff --git a/.github/workflows/pkgci_test_amd_mi300.yml b/.github/workflows/pkgci_test_amd_mi300.yml
index 78e8968..ba5ad94 100644
--- a/.github/workflows/pkgci_test_amd_mi300.yml
+++ b/.github/workflows/pkgci_test_amd_mi300.yml
@@ -24,6 +24,8 @@
PACKAGE_DOWNLOAD_DIR: ${{ github.workspace }}/.packages
BUILD_DIR: build-tests
VENV_DIR: ${{ github.workspace }}/.venv
+ CC: clang
+ CXX: clang++
IREE_CPU_DISABLE: 1
IREE_VULKAN_DISABLE: 1
IREE_CUDA_DISABLE: 1
@@ -49,10 +51,6 @@
./build_tools/pkgci/setup_venv.py ${VENV_DIR} \
--artifact-path=${PACKAGE_DOWNLOAD_DIR} \
--fetch-gh-workflow=${{ inputs.artifact_run_id }}
- - name: Configure build toolchain
- run: |
- echo "CC=clang" >> $GITHUB_ENV
- echo "CXX=clang++" >> $GITHUB_ENV
- name: Build tests
run: ./build_tools/pkgci/build_tests_using_package.sh ${VENV_DIR}/bin
diff --git a/.github/workflows/pkgci_test_android.yml b/.github/workflows/pkgci_test_android.yml
index b297f0c..bb12582 100644
--- a/.github/workflows/pkgci_test_android.yml
+++ b/.github/workflows/pkgci_test_android.yml
@@ -37,6 +37,8 @@
PACKAGE_DOWNLOAD_DIR: ${{ github.workspace }}/.packages
VENV_DIR: ${{ github.workspace }}/.venv
IREE_TARGET_BUILD_DIR: build-android-arm_64
+ CC: clang
+ CXX: clang++
steps:
# General setup.
- name: "Checking out repository"
@@ -62,11 +64,7 @@
--artifact-path=${PACKAGE_DOWNLOAD_DIR} \
--fetch-gh-workflow=${{ inputs.artifact_run_id }}
- name: Install build dependencies
- run: |
- sudo apt update
- sudo apt install -y ninja-build
- echo "CC=clang" >> $GITHUB_ENV
- echo "CXX=clang++" >> $GITHUB_ENV
+ run: sudo apt update && sudo apt install -y ninja-build
- uses: nttld/setup-ndk@v1
with:
diff --git a/.github/workflows/pkgci_test_nvidia_t4.yml b/.github/workflows/pkgci_test_nvidia_t4.yml
index acf63fe..c767455 100644
--- a/.github/workflows/pkgci_test_nvidia_t4.yml
+++ b/.github/workflows/pkgci_test_nvidia_t4.yml
@@ -29,6 +29,8 @@
PACKAGE_DOWNLOAD_DIR: ${{ github.workspace }}/.packages
BUILD_DIR: build-tests
VENV_DIR: ${{ github.workspace }}/.venv
+ CC: clang
+ CXX: clang++
IREE_CPU_DISABLE: 1
IREE_VULKAN_DISABLE: 0
IREE_CUDA_DISABLE: 0
@@ -61,8 +63,6 @@
run: |
sudo apt update
sudo apt install -y cmake clang ninja-build libstdc++-12-dev
- echo "CC=clang" >> $GITHUB_ENV
- echo "CXX=clang++" >> $GITHUB_ENV
- name: Build tests
run: ./build_tools/pkgci/build_tests_using_package.sh ${VENV_DIR}/bin
diff --git a/.github/workflows/pkgci_test_riscv64.yml b/.github/workflows/pkgci_test_riscv64.yml
index e253360..4ec6b47 100644
--- a/.github/workflows/pkgci_test_riscv64.yml
+++ b/.github/workflows/pkgci_test_riscv64.yml
@@ -36,6 +36,8 @@
env:
PACKAGE_DOWNLOAD_DIR: ${{ github.workspace }}/.packages
VENV_DIR: ${{ github.workspace }}/.venv
+ CC: clang
+ CXX: clang++
BOOTSTRAP_WORK_DIR: ${{ github.workspace }}/.bootstrap
RISCV_RV64_LINUX_TOOLCHAIN_ROOT: ${{ github.workspace }}/riscv/toolchain
QEMU_PATH_PREFIX: ${{ github.workspace }}/riscv/qemu
@@ -59,11 +61,7 @@
name: linux_x86_64_release_packages
path: ${{ env.PACKAGE_DOWNLOAD_DIR }}
- name: Install build dependencies
- run: |
- sudo apt update
- sudo apt install -y ninja-build
- echo "CC=clang" >> $GITHUB_ENV
- echo "CXX=clang++" >> $GITHUB_ENV
+ run: sudo apt update && sudo apt install -y ninja-build
- name: Setup base venv
run: |
./build_tools/pkgci/setup_venv.py ${VENV_DIR} \
diff --git a/.github/workflows/publish_website.yml b/.github/workflows/publish_website.yml
index 7df2052..86b71e5 100644
--- a/.github/workflows/publish_website.yml
+++ b/.github/workflows/publish_website.yml
@@ -30,6 +30,9 @@
publish_website:
# Note: a clean build of `iree-tblgen` takes ~5 minutes on standard runners.
runs-on: ubuntu-20.04
+ env:
+ CC: clang
+ CXX: clang++
steps:
- name: Checkout out repository
uses: actions/checkout@v4.1.7
@@ -50,8 +53,6 @@
pip install requests
sudo apt update
sudo apt install -y ninja-build
- echo "CC=clang" >> $GITHUB_ENV
- echo "CXX=clang++" >> $GITHUB_ENV
- name: Generating release index
run: |
./build_tools/scripts/generate_release_index.py \
diff --git a/.github/workflows/samples.yml b/.github/workflows/samples.yml
index 2a92561..7cb87e2 100644
--- a/.github/workflows/samples.yml
+++ b/.github/workflows/samples.yml
@@ -41,17 +41,16 @@
samples:
runs-on: ubuntu-20.04
+ env:
+ CC: clang
+ CXX: clang++
steps:
- name: "Checking out repository"
uses: actions/checkout@v4.1.7
- name: "Checking out runtime submodules"
run: ./build_tools/scripts/git/update_runtime_submodules.sh
- name: "Installing build dependencies"
- run: |
- sudo apt update
- sudo apt install -y ninja-build
- echo "CC=clang" >> $GITHUB_ENV
- echo "CXX=clang++" >> $GITHUB_ENV
+ run: sudo apt update && sudo apt install -y ninja-build
- name: "Setting up Python"
uses: actions/setup-python@v5.1.0
with:
@@ -63,6 +62,8 @@
runs-on: ubuntu-20.04
env:
VENV_DIR: ${{ github.workspace }}/.venv
+ CC: clang
+ CXX: clang++
defaults:
run:
shell: bash
@@ -74,11 +75,7 @@
- name: "Check out runtime submodules"
run: ./build_tools/scripts/git/update_runtime_submodules.sh
- name: "Installing build dependencies"
- run: |
- sudo apt update
- sudo apt install -y ninja-build
- echo "CC=clang" >> $GITHUB_ENV
- echo "CXX=clang++" >> $GITHUB_ENV
+ run: sudo apt update && sudo apt install -y ninja-build
- uses: actions/setup-python@v5.1.0
with:
python-version: "3.11"