Skip to content

Build Linux Packages #17

Build Linux Packages

Build Linux Packages #17

name: Build Linux Packages
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
inputs:
package_version:
required: true
type: string
default: ADHOCBUILD
workflow_call:
inputs:
package_version:
required: true
type: string
jobs:
build_linux_packages:
name: Build Linux Packages
runs-on: nod-ai-shared-cpubuilder-manylinux-x86_64
strategy:
fail-fast: true
env:
CACHE_DIR: ${{ github.workspace }}/.container-cache
CCACHE_DIR: "${{ github.workspace }}/.container-cache/ccache"
CCACHE_MAXSIZE: "700M"
steps:
- name: "Checking out repository"
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- name: Report Runner Health
run: |
echo "CCACHE_DIR=${CCACHE_DIR}"
df -h
ccache -z
mkdir -p $CCACHE_DIR
cmake --version
# TODO: We shouldn't be using a cache on actual release branches, but it
# really helps for iteration time.
- name: Enable cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHE_DIR }}
key: linux-build-packages-manylinux-v2-${{ github.sha }}
restore-keys: |
linux-build-packages-manylinux-v2-
- name: Install Deps
run: |
curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo
chmod a+x /usr/local/bin/repo
yum install -y numactl-devel elfutils-libelf-devel vim-common git-lfs
pip install CppHeaderParser
- name: Fetch sources
run: |
./fetch_sources.sh
- name: Apply patches
run: |
./apply_patches.sh
# The full checkout is very large: ~16GB, 9 of which is GIT stuff.
# So we delete the latter. This must be done after getting any git
# stamps or such things.
- name: Trim Disk Space
run: |
rm -Rf sources/.repo
# Delete some things that we aren't building.
# TODO: Would be better to have repo only fetch a smaller working set.
rm -Rf sources/MIVisionX # ~200M
rm -Rf sources/MIOpen # ~400M
rm -Rf sources/hipBLASLt # ~750M
rm -Rf sources/rocBLAS # ~900M
rm -Rf sources/ROCK-Kernel-Driver # ~1.5G
df -h
- name: Build Projects
run: |
# Generate a new build id.
package_version="${{ inputs.package_version }}"
echo "Building package ${package_version}"
# Build.
cmake -B build -GNinja . \
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DTHEROCK_PACKAGE_VERSION="${package_version}"
cmake --build build
- name: Build Tarballs
run: |
(cd build && cpack -G TXZ)
- name: Report
if: ${{ !cancelled() }}
run: |
ls -lh build
ccache -s
- name: Upload runtime artifacts
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: TheRock-runtime-linux-x86_64-tarball
path: |
build/TheRock-amdgpu-runtime-*.tar.xz
if-no-files-found: warn
- name: Upload compiler artifacts
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: TheRock-compiler-linux-x86_64-tarball
path: |
build/TheRock-amdgpu-compiler*.tar.xz
if-no-files-found: warn
- name: Save cache
uses: actions/cache/save@v3
if: always()
with:
path: ${{ env.CACHE_DIR }}
key: linux-build-packages-manylinux-v2-${{ github.sha }}