-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor common steps and add python release.
- Loading branch information
1 parent
a9ee7bc
commit f51da82
Showing
9 changed files
with
231 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
name: Build Linux Packages | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- .github/workflows/build_python_packages.yml | ||
- python_projects/* | ||
|
||
workflow_dispatch: | ||
inputs: | ||
package_version: | ||
required: false | ||
type: string | ||
package_suffix: | ||
required: false | ||
type: string | ||
|
||
workflow_call: | ||
inputs: | ||
package_version: | ||
required: false | ||
type: string | ||
package_suffix: | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
build_python_packages: | ||
name: Build Python 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: build-python-manylinux-v2-${{ github.sha }} | ||
restore-keys: | | ||
build-python-manylinux-v2- | ||
- name: Install Deps | ||
run: | | ||
./build_tools/ci_install_build_deps.sh | ||
- name: Fetch sources | ||
run: | | ||
./build_tools/fetch_sources.py | ||
# 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 | ||
df -h | ||
- name: Build Projects | ||
run: | | ||
cd python_projects/runtime | ||
export THEROCK_PY_VERSION="${{ inputs.package_version }}" | ||
export THEROCK_PY_SUFFIX="${{ inputs.package_suffix }}" | ||
export CMAKE_C_COMPILER_LAUNCHER=ccache | ||
export CMAKE_CXX_COMPILER_LAUNCHER=ccache | ||
echo "Building package ${THEROCK_PY_VERSION}" | ||
pip wheel -v . | ||
auditwheel TheRock_runtime*.whl | ||
- name: Report | ||
if: ${{ !cancelled() }} | ||
run: | | ||
ls -lh build build/wheelhouse | ||
ccache -s | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: TheRock-python-runtime-linux-x86_64 | ||
path: | | ||
python_projects/runtime/wheelhouse/*.whl | ||
if-no-files-found: warn | ||
|
||
- name: Save cache | ||
uses: actions/cache/save@v3 | ||
if: always() | ||
with: | ||
path: ${{ env.CACHE_DIR }} | ||
key: build-python-manylinux-v2-${{ github.sha }} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/usr/bin/env python | ||
# Fetches sources from a specified branch/set of projects. | ||
# This script is available for users, but it is primarily the mechanism | ||
# the CI uses to get to a clean state. | ||
|
||
import argparse | ||
from pathlib import Path | ||
import subprocess | ||
import sys | ||
|
||
DEFAULT_SOURCES_DIR = Path(__file__).resolve().parent.parent / "sources" | ||
|
||
|
||
def exec(args: list[str], cwd: Path): | ||
print(f"++ Exec: {args} (in {cwd})") | ||
subprocess.check_call(args, cwd=str(cwd)) | ||
|
||
|
||
def run(args): | ||
repo_dir: Path = args.dir | ||
print(f"Setting up repo in {repo_dir}") | ||
repo_dir.mkdir(exist_ok=True, parents=True) | ||
exec( | ||
[ | ||
"repo", | ||
"init", | ||
"-u", | ||
"https://github.com/RadeonOpenCompute/ROCm.git", | ||
"--depth=1", | ||
], | ||
cwd=repo_dir, | ||
) | ||
exec(["repo", "sync", "-j16"] + args.projects, cwd=repo_dir) | ||
|
||
# Fixup LLVM. | ||
if "llvm-project" in args.projects: | ||
print("Fixing up llvm-project") | ||
llvm_dir = repo_dir / "llvm-project" | ||
exec(["git", "fetch", "rocm-org", "amd-staging", "--depth=1"], cwd=llvm_dir) | ||
exec(["git", "checkout", "rocm-org/amd-staging"], cwd=llvm_dir) | ||
|
||
# Patches. | ||
if not args.no_patch: | ||
apply_patches(args) | ||
|
||
|
||
def apply_patches(args): | ||
# TODO: Can just merge this script in here if it survives. | ||
script = Path(__file__).resolve().parent / "apply_patches.sh" | ||
exec([script], cwd=args.dir) | ||
|
||
|
||
def main(argv): | ||
parser = argparse.ArgumentParser(prog="fetch_sources") | ||
parser.add_argument( | ||
"--dir", type=Path, help="Repo dir", default=DEFAULT_SOURCES_DIR | ||
) | ||
parser.add_argument( | ||
"--branch", type=str, help="Branch to sync", default="amd-staging" | ||
) | ||
parser.add_argument("--no-patch", action="store_true", help="Disable patching") | ||
parser.add_argument( | ||
"--projects", | ||
nargs="+", | ||
type=str, | ||
default=[ | ||
"clr", | ||
"HIP", | ||
"llvm-project", | ||
"rocm-cmake", | ||
"rocm-core", | ||
"ROCR-Runtime", | ||
"ROCT-Thunk-Interface", | ||
], | ||
) | ||
args = parser.parse_args(argv) | ||
run(args) | ||
|
||
|
||
if __name__ == "__main__": | ||
main(sys.argv[1:]) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,10 @@ def finalize_options(self): | |
bdist_wheel = None | ||
|
||
|
||
VERSION = os.getenv("THEROCK_PY_VERSION", "0.1.dev1") | ||
VERSION = os.getenv("THEROCK_PY_VERSION", None) | ||
SUFFIX = os.getenv("THEROCK_PY_SUFFIX", "") | ||
if not VERSION: | ||
VERSION = "0.1.dev1" | ||
SETUPPY_DIR = Path(__file__).resolve().parent | ||
SOURCE_DIR = SETUPPY_DIR.parent.parent | ||
# Note that setuptools always builds into a "build" directory that | ||
|
@@ -107,7 +110,7 @@ def run(self): | |
CMAKE_BUILD_DIR.mkdir(parents=True, exist_ok=True) | ||
|
||
setup( | ||
name=f"TheRock-runtime", | ||
name=f"TheRock-runtime{SUFFIX}", | ||
version=f"{VERSION}", # TODO: Get from env var. | ||
author="TheRock Authors", | ||
author_email="[email protected]", | ||
|