Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 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
52 changes: 52 additions & 0 deletions .github/actions/artifact_upload_action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Artifact Upload"

inputs:
build_directory:
type: string
amdgpu_families:
type: string

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.

I have some conflicting feelings about adding this and build_linux_action as composite actions. My original suggestion was to extract the repository setup into an action and not the building.

Pros:

  • It keeps the build workflows more focused on the high level operations needed.
  • It allows us to share these steps with multiple workflow files.

Cons:

  • Reuse is possible by moving logic from yml into scripts. Ideally the scripts are integrated into the build scripts or infrastructure servers themselves and run seamlessly. I'm not really seeing the value in having a different repository reuse github actions. The code should be simple enough that actions can be easily reimplemented.
  • Splitting workflows across multiple files makes it harder to see what they are doing both for CI/CD maintenance and for developers wanting to reproduce what the CI does.
  • The logs on https://github.com/ROCm/TheRock/actions/runs/15614427714/job/43986995984?pr=782 look pretty clean, but the individual steps under each workflow are now folded together. I like being able to see "fetch sources", "CMake configure", and "CMake build" separately with their own timing, for example.

I'm happy to unblock the monorepo testing work, so I can put aside some of the concerns. We can remove code from these files as they move to scripts or get more naturally integrated into the build system, then eventually maybe move back into inlined workflow steps to get back the benefits of having fine-grained logging and timing.

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 was going to follow your initial suggestion, but it felt weird to include checkout steps for rocm-libraries when TheRock never even uses it. For me, it felt better to keep build_linux_packages as a reusable workflow.

I agree that it does bunch it up :( so this makes debugging a bit more difficult

In that case, I'll actually move these to scripts (s3 artifact upload practically does this), so it can be reusable, better visibility in steps and easily implemented

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.

Honestly... the more I am working on this, I think it may be best to just re-create this yml file inside of rocm-libraries, and the only new custom step would be checking out rocm-libraries.

But, this is still good organization and cleanup, so I will keep this PR

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.

Yeah, it's good to explore the convince ourselves that the direction makes sense. This is also highlighting some of the areas that should be streamlined regardless of which repository the code is running from (or running locally).


runs:
using: "composite"
steps:
- name: Configure AWS Credentials
if: always()
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::692859939525:role/therock-artifacts

- name: Create Logs index Files
shell: bash
if: always()
run: |
python3 build_tools/github_actions/create_log_index.py \
--build-dir=${{ inputs.build_directory }} \
--amdgpu-family=${{ inputs.amdgpu_families }}

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.

(Not in this PR, but relating to the positioning of this as a composite workflow)

This should be moved to server-side


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

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

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.

(Not in this PR, but relating to the positioning of this as a composite workflow)

This should be moved to teatime.py: #648


- name: Add Links to Job Summary
shell: bash
if: always()
run: |
python build_tools/github_actions/upload_build_summary.py \
--run-id ${{ github.run_id }} \
--amdgpu-family ${{ inputs.amdgpu_families }} \
--build-dir ${{ inputs.build_directory }}
70 changes: 70 additions & 0 deletions .github/actions/build_linux_action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: "Build Linux Package Action"

inputs:
package_version:
type: string
amdgpu_families:
type: string
extra_cmake_options:
type: string

runs:
using: "composite"
steps:
- name: Fetch sources
shell: bash
run: |
./build_tools/fetch_sources.py --jobs 12

- name: Install python deps
shell: bash
run: |
pip install -r requirements.txt

- name: Configure Projects
shell: bash
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}

- name: Build therock-dist
shell: bash
run: cmake --build build --target therock-dist

- name: Build therock-archives
shell: bash
run: cmake --build build --target therock-archives

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

- name: Report
shell: bash
if: ${{ !cancelled() }}
run: |
echo "Full SDK du:"
echo "------------"
du -h -d 1 build/dist/rocm
echo "Artifact Archives:"
echo "------------------"
ls -lh build/artifacts/*.tar.xz
echo "Artifacts:"
echo "----------"
du -h -d 1 build/artifacts
echo "CCache Stats:"
echo "-------------"
ccache -s

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.

(Not in this PR, but relating to the positioning of this as a composite workflow)

This should be moved to a script - we can run a "check environment before building" script for #762 and a "check environment after building" script here

117 changes: 19 additions & 98 deletions .github/workflows/build_linux_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ on:
type: boolean
extra_cmake_options:
type: string
subtree:
type: string
secrets:
rocm_libraries_app_id:
required: false
rocm_libraries_app_private_key:
required: false

Comment thread
geomin12 marked this conversation as resolved.
Outdated

# 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 +56,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"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "ROCm/TheRock"

- name: "Checking out repository for rocm-libraries"
if: ${{ github.repository == 'ROCm/rocm-libraries' }}
- name: Checkout Repository
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 All @@ -87,94 +84,18 @@ jobs:
restore-keys: |
linux-build-packages-manylinux-v3-${{ inputs.amdgpu_families }}-

- name: Fetch sources
run: |
./build_tools/fetch_sources.py --jobs 12

- name: Install python deps
run: |
pip install -r requirements.txt

- name: Configure Projects
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}

- name: Build therock-dist
run: cmake --build build --target therock-dist

- name: Build therock-archives
run: cmake --build build --target therock-archives

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

- name: Report
if: ${{ !cancelled() }}
run: |
echo "Full SDK du:"
echo "------------"
du -h -d 1 build/dist/rocm
echo "Artifact Archives:"
echo "------------------"
ls -lh build/artifacts/*.tar.xz
echo "Artifacts:"
echo "----------"
du -h -d 1 build/artifacts
echo "CCache Stats:"
echo "-------------"
ccache -s

- name: Configure AWS Credentials
if: always()
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
- name: Build Linux Packages
uses: './.github/actions/build_linux_action'
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::692859939525:role/therock-artifacts

- name: Create Logs index Files
if: always()
run: |
python3 build_tools/github_actions/create_log_index.py \
--build-dir=build \
--amdgpu-family=${{ env.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/

- 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 }}
package_version: ${{ inputs.package_version }}
amdgpu_families: ${{ inputs.amdgpu_families }}
extra_cmake_options: ${{ inputs.extra_cmake_options }}

- 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/
- name: Artifact Upload
uses: './.github/actions/artifact_upload_action'
with:
build_directory: "build"
amdgpu_families: ${{ inputs.amdgpu_families }}

- name: Save cache
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
Expand Down
40 changes: 4 additions & 36 deletions .github/workflows/build_windows_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,43 +189,11 @@ jobs:
$fsout | % {$_.Used/=1GB;$_.Free/=1GB;$_} | Write-Host
get-disk | Select-object @{Name="Size(GB)";Expression={$_.Size/1GB}} | Write-Host

- name: Configure AWS Credentials
if: always()
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
- name: Artifact Upload
uses: './.github/actions/artifact_upload_action'
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::692859939525:role/therock-artifacts

- name: Create Logs index Files
if: always()
run: |
python3 build_tools/github_actions/create_log_index.py \
--build-dir=${{ env.BUILD_DIR_BASH }} \
--amdgpu-family=${{ env.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 ${{ env.BUILD_DIR_BASH }}

- name: Upload Logs
if: always()
run: |
python3 build_tools/github_actions/upload_build_logs_to_s3.py \
--build-dir=${{ env.BUILD_DIR_BASH }} \
--run-id ${{ github.run_id }} \
--amdgpu-family ${{ env.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 ${{ env.BUILD_DIR_BASH }}
build_directory: ${{ env.BUILD_DIR_BASH }}
amdgpu_families: ${{ inputs.amdgpu_families }}

- name: Save cache
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
Expand Down
Loading