Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions .github/actions/setup_test_environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ inputs:
type: string
PLATFORM:
type: string
BUCKET:
type: string
default: "therock-artifacts"

runs:
using: "composite"
Expand Down Expand Up @@ -56,6 +59,7 @@ runs:
AMDGPU_FAMILIES: ${{ inputs.AMDGPU_FAMILIES }}
FETCH_ARTIFACT_ARGS: ${{ inputs.FETCH_ARTIFACT_ARGS }}
GITHUB_TOKEN: ${{ github.token }}
BUCKET: ${{ inputs.BUCKET }}
run: |
python ./build_tools/install_rocm_from_artifacts.py \
--run-id=${ARTIFACT_RUN_ID} \
Expand Down
31 changes: 25 additions & 6 deletions .github/workflows/build_linux_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
expect_failure:
type: boolean
default: false
extra_cmake_options:
type: string

workflow_call:
inputs:
Expand All @@ -21,6 +23,8 @@ on:
type: string
expect_failure:
type: boolean
extra_cmake_options:
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 @@ -44,9 +48,20 @@ 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"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "ROCm/TheRock"

- name: "Checking out repository for rocm-libraries"
if: ${{ github.repository == 'ROCm/rocm-libraries' }}
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.

With view on more monorepos we might want to make this more flexible but also need take care of PRs from forks (either to one of the monorepos or TheRock). Maybe add a TODO note for now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I could actually make it github.event.repository.name == TheRock in order to work with both forks + normal so I will do that!

Copy link
Copy Markdown
Member

@marbre marbre May 22, 2025

Choose a reason for hiding this comment

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

Happy if that works for all the potential use cases. I think we need to cover PRs

  • from within TheRock
  • from forks of TheRock targeting TheRock
  • form within a monorepo (tested via TheRock)
  • form forks of a monorepo targeting the monorepo (tested via TheRock)

I am not familiar enough with GH's event API thus not saying that what you plan doesn't work :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That should work I expect.

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 @@ -85,6 +100,7 @@ jobs:
run: |
# Generate a new build id.
package_version="${{ inputs.package_version }}"
extra_cmake_options="${{ inputs.extra_cmake_options }}"
echo "Building package ${package_version}"

# Build.
Expand All @@ -93,10 +109,13 @@ jobs:
-DTHEROCK_AMDGPU_FAMILIES=${{env.AMDGPU_FAMILIES}} \
-DTHEROCK_PACKAGE_VERSION="${package_version}" \
-DTHEROCK_VERBOSE=ON \
-DBUILD_TESTING=ON
-DBUILD_TESTING=ON \
${extra_cmake_options}

cmake --build build --target therock-archives therock-dist

- name: Test Packaging
if: ${{ github.event.repository.name == 'TheRock' }}
run: |
ctest --test-dir build --output-on-failure

Expand Down Expand Up @@ -145,28 +164,28 @@ jobs:
# TODO: Move to script
- name: Upload Artifacts
run: |
aws s3 cp build/artifacts/ s3://therock-artifacts/${{github.run_id}}-linux/ \
aws s3 cp build/artifacts/ s3://${{env.BUCKET}}/${{github.run_id}}-linux/ \
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

currently, for external repos (ex: rocm-libraries), this still uploads all to the dir /.

After this PR, I plan to move this upload items into script in another PR and adding env.REPO to there to allow therock-external/rocm-libraries/123456-linux

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation - def a good thing we need to fix.

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.

Would therock-external correspond to env.BUCKET and rocm-libraries to env.REPO then? From a naming perspective, if env.REPO just specifies a subdir in the bucket you could call it env.S3_SUBDIR to make the purpose more clear.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correct! Although repo is not used (yet) so I will add this in the next PR!

--recursive --no-follow-symlinks \
--exclude "*" \
--include "*.tar.xz*"
aws s3 cp build/artifacts/index.html s3://therock-artifacts/${{github.run_id}}-linux/index-${{env.AMDGPU_FAMILIES}}.html
aws s3 cp build/artifacts/index.html s3://${{env.BUCKET}}/${{github.run_id}}-linux/index-${{env.AMDGPU_FAMILIES}}.html

- name: Upload Logs
if: always()
run: |
python3 build_tools/upload_logs_to_s3.py \
--build-dir=build \
--s3-base-path="s3://therock-artifacts/${{github.run_id}}-linux/logs/${{env.AMDGPU_FAMILIES}}"
--s3-base-path="s3://${{env.BUCKET}}/${{github.run_id}}-linux/logs/${{env.AMDGPU_FAMILIES}}"

- name: Add Links to Job Summary
if: always()
run: |
LOG_URL="https://therock-artifacts.s3.us-east-2.amazonaws.com/${{github.run_id}}-linux/logs/${{env.AMDGPU_FAMILIES}}/index.html"
LOG_URL="https://${{env.BUCKET}}.s3.us-east-2.amazonaws.com/${{github.run_id}}-linux/logs/${{env.AMDGPU_FAMILIES}}/index.html"
echo "[Build Logs](${LOG_URL})" >> $GITHUB_STEP_SUMMARY

ARTIFACT_INDEX=build/artifacts/index.html
if [ -f "${ARTIFACT_INDEX}" ]; then
ARTIFACT_URL="https://therock-artifacts.s3.us-east-2.amazonaws.com/${{github.run_id}}-linux/index-${{env.AMDGPU_FAMILIES}}.html"
ARTIFACT_URL="https://${{env.BUCKET}}.s3.us-east-2.amazonaws.com/${{github.run_id}}-linux/index-${{env.AMDGPU_FAMILIES}}.html"

echo "[Artifacts](${ARTIFACT_URL})" >> $GITHUB_STEP_SUMMARY
else
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test_rocprim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "ROCm/TheRock"

- name: Run setup test environment workflow
uses: './.github/actions/setup_test_environment'
Expand All @@ -62,6 +64,7 @@ jobs:
VENV_DIR: ${{ env.VENV_DIR }}
FETCH_ARTIFACT_ARGS: "--prim --tests"
PLATFORM: ${{ inputs.platform }}
BUCKET: ${{ github.repository == 'ROCm/TheRock' && 'therock-artifacts' || 'therock-artifacts-external' }}

- name: Run rocprim tests
env:
Expand Down
7 changes: 5 additions & 2 deletions build_tools/fetch_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# but those artifacts may not have all required dependencies.

import argparse
import os
import platform
import shutil
import subprocess
Expand All @@ -14,6 +15,8 @@
GENERIC_VARIANT = "generic"
PLATFORM = platform.system().lower()

BUCKET = os.getenv("BUCKET", "therock-artifacts")


def log(*args, **kwargs):
print(*args, **kwargs)
Expand All @@ -32,7 +35,7 @@ def s3_bucket_exists(run_id):
"aws",
"s3",
"ls",
f"s3://therock-artifacts/{run_id}-{PLATFORM}",
f"s3://{BUCKET}/{run_id}-{PLATFORM}",
"--no-sign-request",
]
process = subprocess.run(cmd, check=False, stdout=subprocess.DEVNULL)
Expand All @@ -45,7 +48,7 @@ def s3_exec(variant, package, run_id, build_dir):
"aws",
"s3",
"cp",
f"s3://therock-artifacts/{run_id}-{PLATFORM}/{package}_{variant}.tar.xz",
f"s3://{BUCKET}/{run_id}-{PLATFORM}/{package}_{variant}.tar.xz",
str(build_dir),
"--no-sign-request",
]
Expand Down
26 changes: 26 additions & 0 deletions build_tools/github_actions/monorepo_configure_ci.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
This script determines which build flag and tests to run based on SUBTREES

Required environment variables:
- SUBTREES
"""

from configure_ci import set_github_output
import json
from monorepo_map import monorepo_map
import os

SUBTREES = os.getenv("SUBTREES", "")


def run():
subtrees = SUBTREES.split("\n")
jobs = []
for subtree in subtrees:
if subtree in monorepo_map:
jobs.append(monorepo_map.get(subtree))
set_github_output({"jobs": json.dumps(jobs)})


if __name__ == "__main__":
run()
9 changes: 9 additions & 0 deletions build_tools/github_actions/monorepo_map.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""
This dictionary is used to map specific file directory changes to the corresponding build flag and tests
"""
monorepo_map = {
"projects/rocprim": {
"flag": "-DTHEROCK_ENABLE_PRIM=ON -DTHEROCK_ENABLE_ALL=OFF",
"test": "test_rocprim",
}
}
Loading