Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 14 additions & 31 deletions .github/workflows/build_linux_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ on:
type: boolean
extra_cmake_options:
type: string
subtree:
type: string

# See the details regarding permissions from the link:
# https://github.com/aws-actions/configure-aws-credentials?tab=readme-ov-file#oidc
Expand All @@ -48,20 +50,9 @@ jobs:
CCACHE_MAXSIZE: "700M"
AMDGPU_FAMILIES: ${{ inputs.amdgpu_families }}
TEATIME_FORCE_INTERACTIVE: 0
BUCKET: ${{ github.event.repository.name == 'TheRock' && 'therock-artifacts' || 'therock-artifacts-external' }}
steps:
- name: "Checking out repository"
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "ROCm/TheRock"

- name: "Checking out repository for rocm-libraries"
if: ${{ github.repository == 'ROCm/rocm-libraries' }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "ROCm/rocm-libraries"
ref: ${{ github.head_ref || github.ref_name }}
path: "rocm-libraries"

- name: Runner Health Settings
run: |
Expand Down Expand Up @@ -96,20 +87,12 @@ jobs:
pip install -r requirements.txt

- name: Configure Projects
env:
amdgpu_families: ${{ inputs.amdgpu_families }}
package_version: ${{ inputs.package_version }}
extra_cmake_options: ${{ inputs.extra_cmake_options }}
run: |
# Generate a new build id.
package_version="${{ inputs.package_version }}"
extra_cmake_options="${{ inputs.extra_cmake_options }}"
echo "Building package ${package_version}"

# Build.
cmake -B build -GNinja . \
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DTHEROCK_AMDGPU_FAMILIES=${{env.AMDGPU_FAMILIES}} \
-DTHEROCK_PACKAGE_VERSION="${package_version}" \
-DTHEROCK_VERBOSE=ON \
-DBUILD_TESTING=ON \
${extra_cmake_options}
python3 build_tools/github_actions/build_linux_configure.py

- name: Build therock-dist
run: cmake --build build --target therock-dist
Expand Down Expand Up @@ -150,31 +133,31 @@ jobs:
run: |
python3 build_tools/github_actions/create_log_index.py \
--build-dir=build \
--amdgpu-family=${{ env.AMDGPU_FAMILIES }}
--amdgpu-family=${{ inputs.amdgpu_families }}

- name: Upload artifacts
if: always()
run: |
python build_tools/github_actions/upload_build_artifacts.py \
--run-id ${{ github.run_id }} \
--amdgpu-family ${{ env.AMDGPU_FAMILIES }} \
--build-dir build/
--amdgpu-family ${{ inputs.amdgpu_families }} \
--build-dir build

- name: Upload Logs
if: always()
run: |
python3 build_tools/github_actions/upload_build_logs_to_s3.py \
--build-dir=build \
--run-id ${{ github.run_id }} \
--amdgpu-family ${{ env.AMDGPU_FAMILIES }}
--amdgpu-family ${{ inputs.amdgpu_families }}

- name: Add Links to Job Summary
if: always()
run: |
python build_tools/github_actions/upload_build_summary.py \
--run-id ${{ github.run_id }} \
--amdgpu-family ${{ env.AMDGPU_FAMILIES }} \
--build-dir build/
--amdgpu-family ${{ inputs.amdgpu_families }} \
--build-dir build

- name: Save cache
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
Expand Down
44 changes: 44 additions & 0 deletions build_tools/github_actions/build_linux_configure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""
This script runs the Linux build configuration

Required environment variables:
- amdgpu_families
- package_version
- extra_cmake_options
"""

import logging
import os
from pathlib import Path
import subprocess

logging.basicConfig(level=logging.INFO)
THIS_SCRIPT_DIR = Path(__file__).resolve().parent
THEROCK_DIR = THIS_SCRIPT_DIR.parent.parent

amdgpu_families = os.getenv("amdgpu_families")
package_version = os.getenv("package_version")
extra_cmake_options = os.getenv("extra_cmake_options")


def build_linux_configure():
logging.info(f"Building package {package_version}")
cmd = [
"cmake",
"-B",
"build",
"-GNinja",
".",
"-DCMAKE_C_COMPILER_LAUNCHER=ccache",
"-DCMAKE_CXX_COMPILER_LAUNCHER=ccache",
f"-DTHEROCK_AMDGPU_FAMILIES={amdgpu_families}",
f"-DTHEROCK_PACKAGE_VERSION='{package_version}'",
"-DTHEROCK_VERBOSE=ON",
"-DBUILD_TESTING=ON",
extra_cmake_options,
]
subprocess.run(cmd, cwd=THEROCK_DIR, check=True)
Comment on lines +24 to +40

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does make some sense to put in a script, given the number of options.... but we could also use a CMake preset instead. Can even use environment variables in them: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html.

https://github.com/ROCm/TheRock/blob/main/CMakePresets.json



if __name__ == "__main__":
build_linux_configure()