Skip to content
Open
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
95 changes: 92 additions & 3 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,64 @@ run-name: >

jobs:

check_changes:
runs-on: ubuntu-latest
outputs:
should_build: ${{ steps.filter.outputs.should_build }}
changed_files: ${{ steps.filter.outputs.changed_files }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0

- name: Check for relevant file changes
id: filter
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "should_build=true" >> $GITHUB_OUTPUT
echo "Workflow dispatch - proceeding with build"
exit 0
fi

git fetch origin ${{ github.base_ref }} --depth=1
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)

echo "Changed files:"
echo "$CHANGED_FILES"

# Store changed files for reuse in later jobs
echo "changed_files<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGED_FILES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

# Check for build_info.json, .sh scripts, or Dockerfile
RELEVANT_CHANGES=$(echo "$CHANGED_FILES" | grep -E '(build_info\.json|\.sh$|Dockerfile)' || true)

if [ -n "$RELEVANT_CHANGES" ]; then
echo "should_build=true" >> $GITHUB_OUTPUT
echo "✅ Found relevant changes:"
echo "$RELEVANT_CHANGES"
else
echo "should_build=false" >> $GITHUB_OUTPUT
echo "⏭️ Skipping PR build CI check - no changes related to build_info.json, build scripts (.sh), or Dockerfile"
fi


build_info:
needs: check_changes
if: needs.check_changes.outputs.should_build == 'true'
runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04-ppc64le-p10' || inputs.large-runner }}

steps:
- name: Checkout code (Pull Request)
if: github.event_name == 'pull_request'
uses: actions/checkout@v6
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0

- name: Checkout code (Workflow Dispatch)
Expand Down Expand Up @@ -77,10 +127,50 @@ jobs:
- name: Fetch base branch
run: git fetch origin ${{ github.base_ref }} --depth=1

# - name: Locate and parse build_info.json
# run: |

# CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)

# BUILD_INFO_FILE=$(echo "$CHANGED_FILES" | grep 'build_info.json' | head -n 1)

# if [ -z "$BUILD_INFO_FILE" ]; then
# echo "No build_info.json modified, trying to detect from changed files..."

# PACKAGE_DIR=$(echo "$CHANGED_FILES" | head -n 1 | cut -d'/' -f1-2)

# BUILD_INFO_FILE="$PACKAGE_DIR/build_info.json"

# if [ ! -f "$BUILD_INFO_FILE" ]; then
# echo "Could not locate build_info.json!"
# exit 1
# fi

# echo "Using fallback build_info: $BUILD_INFO_FILE"
# fi

# PACKAGE_NAME=$(jq -r '.package_name // ""' $BUILD_INFO_FILE)
# VERSION=$(jq -r '.version // ""' $BUILD_INFO_FILE)

# echo "BUILD_INFO_FILE=$BUILD_INFO_FILE" >> $GITHUB_ENV
# echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
# echo "VERSION=$VERSION" >> $GITHUB_ENV
# echo "CHANGED_FILES<<EOF" >> $GITHUB_ENV
# echo "$CHANGED_FILES" >> $GITHUB_ENV
# echo "EOF" >> $GITHUB_ENV



- name: Locate and parse build_info.json
run: |

CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
# Reuse changed files from check_changes job
CHANGED_FILES="${{ needs.check_changes.outputs.changed_files }}"

# If workflow_dispatch, fetch and compute changed files
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
git fetch origin ${{ github.base_ref }} --depth=1
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
fi

BUILD_INFO_FILE=$(echo "$CHANGED_FILES" | grep 'build_info.json' | head -n 1)

Expand Down Expand Up @@ -109,7 +199,6 @@ jobs:
echo "$CHANGED_FILES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV


- name: Read build_info.json
run: |
chmod +x ./gha-script/read_buildinfo.sh
Expand Down
2 changes: 1 addition & 1 deletion gha-script/validate_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


GITHUB_BUILD_SCRIPT_BASE_REPO = "build-scripts"
GITHUB_BUILD_SCRIPT_BASE_OWNER = "ppc64le"
GITHUB_BUILD_SCRIPT_BASE_OWNER = "stutiibm"
HOME = os.getcwd()

package_data = {}
Expand Down
1 change: 1 addition & 0 deletions p/param/Dockerfiles/v2.1.0_ubi_9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ RUN yum update -y && \
cd param && \
git checkout $PACKAGE_VERSION && \
python3 -m pip install build


CMD ["/bin/bash"]