diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index d392615213..68a1d72689 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -27,13 +27,22 @@ run-name: > || github.event.pull_request.title }} jobs: - validate: + + build_info: runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04-ppc64le-p10' || inputs.large-runner }} steps: + # - name: Checkout code + # uses: actions/checkout@v6 + # with: + # fetch-depth: 0 - 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) if: github.event_name == 'workflow_dispatch' @@ -44,7 +53,7 @@ jobs: - name: Install required packages run: | sudo apt update -y - sudo apt-get install -y file + sudo apt-get install -y file jq - name: Install Python dependencies run: | @@ -59,23 +68,255 @@ jobs: python3 -u gha-script/validate_builds.py ${PR_NUMBER:-false} 2>&1 | tee build_log my_pid_status=${PIPESTATUS[0]} - build_size=$(stat -c %s build_log) - if [ "$my_pid_status" -ne 0 ]; then - echo "Script failed for PR #${PR_NUMBER}" - if [ "$build_size" -lt 1800000 ]; then - cat build_log - else - echo "Build log too large, showing last 100 lines" - tail -100 build_log - fi - exit 1 + echo "Script failed for PR #${PR_NUMBER}" + echo "::group::Validation Logs" + tail -200 build_log + echo "::endgroup::" + exit 1 + else + echo "Script completed successfully for PR #${PR_NUMBER}" + fi + + - 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" | grep '/' | 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 + + - name: Read build_info.json + run: | + chmod +x ./gha-script/read_buildinfo.sh + bash ./gha-script/read_buildinfo.sh + + - name: Create scanner-env.sh + run: | + mkdir -p package-cache + + PACKAGE_DIR=$(jq -r '.package_dir // ""' $BUILD_INFO_FILE) + WHEEL_BUILD=$(jq -r '.wheel_build // "false"' $BUILD_INFO_FILE) + + if jq -e '.docker_build == true or .docker_build == "true"' "$BUILD_INFO_FILE" > /dev/null; then + DOCKER_BUILD="true" else - echo "Script completed successfully for PR #${PR_NUMBER}" - if [ "$build_size" -lt 1800000 ]; then - cat build_log - else - echo "Build log too large, showing last 100 lines" - tail -100 build_log - fi + DOCKER_BUILD="false" + fi + + cat < package-cache/scanner-env.sh + export PACKAGE_NAME=$PACKAGE_NAME + export VERSION=$VERSION + export PACKAGE_DIR=$PACKAGE_DIR + export WHEEL_BUILD=$WHEEL_BUILD + export BUILD_DOCKER=$DOCKER_BUILD + EOF + + mv variable.sh package-cache/ + + - name: Archive package cache + run: tar -czf package-cache.tar.gz package-cache/ + + - name: Upload package cache + uses: actions/upload-artifact@v6 + with: + name: package-cache + path: package-cache.tar.gz + + build: + needs: build_info + runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04-ppc64le-p10' || inputs.large-runner }} + + steps: + - uses: actions/checkout@v6 + + - name: Download package-cache + uses: actions/download-artifact@v7 + with: + name: package-cache + + - name: Extract package cache + run: tar -xzf package-cache.tar.gz + + - name: Build Package + run: | + source package-cache/variable.sh + source package-cache/scanner-env.sh + + chmod +x ./gha-script/build_package.sh + bash ./gha-script/build_package.sh + +# ===================== WHEEL JOBS ===================== + + wheel_build_py39: + needs: build_info + if: ${{ success() }} + runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04-ppc64le-p10' || inputs.large-runner }} + continue-on-error: true + env: + PYTHON_VERSION: "3.9" + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - run: sudo apt update -y + + - uses: actions/download-artifact@v7 + with: + name: package-cache + + - run: tar -xzf package-cache.tar.gz + + - run: | + source package-cache/variable.sh + source package-cache/scanner-env.sh + + if [ "$WHEEL_BUILD" != "true" ]; then + echo "Skipping wheel build" + exit 0 + fi + + chmod +x ./gha-script/build_wheels.sh + bash ./gha-script/build_wheels.sh + + wheel_build_py310: + needs: build_info + if: ${{ success() }} + runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04-ppc64le-p10' || inputs.large-runner }} + env: + PYTHON_VERSION: "3.10" + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - run: sudo apt update -y + - uses: actions/download-artifact@v7 + with: + name: package-cache + - run: tar -xzf package-cache.tar.gz + - run: | + source package-cache/variable.sh + source package-cache/scanner-env.sh + if [ "$WHEEL_BUILD" != "true" ]; then exit 0; fi + chmod +x ./gha-script/build_wheels.sh + bash ./gha-script/build_wheels.sh + + wheel_build_py311: + needs: build_info + if: ${{ success() }} + runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04-ppc64le-p10' || inputs.large-runner }} + env: + PYTHON_VERSION: "3.11" + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - run: sudo apt update -y + - uses: actions/download-artifact@v7 + with: + name: package-cache + - run: tar -xzf package-cache.tar.gz + - run: | + source package-cache/variable.sh + source package-cache/scanner-env.sh + if [ "$WHEEL_BUILD" != "true" ]; then exit 0; fi + chmod +x ./gha-script/build_wheels.sh + bash ./gha-script/build_wheels.sh + + wheel_build_py312: + needs: build_info + if: ${{ success() }} + runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04-ppc64le-p10' || inputs.large-runner }} + env: + PYTHON_VERSION: "3.12" + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - run: sudo apt update -y + - uses: actions/download-artifact@v7 + with: + name: package-cache + - run: tar -xzf package-cache.tar.gz + - run: | + source package-cache/variable.sh + source package-cache/scanner-env.sh + if [ "$WHEEL_BUILD" != "true" ]; then exit 0; fi + chmod +x ./gha-script/build_wheels.sh + bash ./gha-script/build_wheels.sh + + wheel_build_py313: + needs: build_info + if: ${{ success() }} + runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04-ppc64le-p10' || inputs.large-runner }} + continue-on-error: true + env: + PYTHON_VERSION: "3.13" + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - run: sudo apt update -y + - uses: actions/download-artifact@v7 + with: + name: package-cache + - run: tar -xzf package-cache.tar.gz + - run: | + source package-cache/variable.sh + source package-cache/scanner-env.sh + if [ "$WHEEL_BUILD" != "true" ]; then exit 0; fi + chmod +x ./gha-script/build_wheels.sh + bash ./gha-script/build_wheels.sh + + build_docker: + needs: build_info + if: ${{ success() }} + runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04-ppc64le-p10' || inputs.large-runner }} + + steps: + - uses: actions/checkout@v6 + - uses: actions/download-artifact@v7 + with: + name: package-cache + - run: tar -xzf package-cache.tar.gz + - run: | + source package-cache/variable.sh + source package-cache/scanner-env.sh + + BUILD_DOCKER=$(echo "$BUILD_DOCKER" | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]') + + if [[ "$BUILD_DOCKER" != "true" ]]; then + echo "Skipping Docker build" + exit 0 fi + + chmod +x ./gha-script/build_docker.sh + bash ./gha-script/build_docker.sh diff --git a/gha-script/build_package.sh b/gha-script/build_package.sh index 8c1cd2ee24..f6308ac23a 100755 --- a/gha-script/build_package.sh +++ b/gha-script/build_package.sh @@ -55,21 +55,21 @@ if [ $my_pid_status != 0 ]; then echo "Script execution failed for "$PKG_DIR_PATH$BUILD_SCRIPT" "$VERSION" " echo "*************************************************************************************" - if [ $build_size -lt 1800000 ]; - then - cat build_log - else - tail -100 build_log - fi + # if [ $build_size -lt 1800000 ]; + # then + # cat build_log + # else + # tail -100 build_log + # fi exit 1 else echo "Script execution completed successfully for "$PKG_DIR_PATH$BUILD_SCRIPT" "$VERSION" " echo "*************************************************************************************" - if [ $build_size -lt 1800000 ]; - then - cat build_log - else - tail -100 build_log - fi + # if [ $build_size -lt 1800000 ]; + # then + # cat build_log + # else + # tail -100 build_log + # fi fi exit 0 diff --git a/gha-script/build_wheels.sh b/gha-script/build_wheels.sh index 37d49b67b6..1ee24c07ee 100644 --- a/gha-script/build_wheels.sh +++ b/gha-script/build_wheels.sh @@ -59,21 +59,30 @@ if [ $wheel_status != 0 ]; then echo "Wheel build failed for "$PKG_DIR_PATH$BUILD_SCRIPT" "$VERSION" " echo "*************************************************************************************" - if [ $log_size -lt 1800000 ]; - then - cat wheel_build_log - else - tail -100 wheel_build_log - fi exit 1 else echo "Script execution completed successfully for "$PKG_DIR_PATH$BUILD_SCRIPT" "$VERSION" " echo "*************************************************************************************" - if [ $log_size -lt 1800000 ]; - then - cat wheel_build_log - else - tail -100 wheel_build_log - fi fi +# if [ $wheel_status != 0 ]; +# then +# echo "Wheel build failed for "$PKG_DIR_PATH$BUILD_SCRIPT" "$VERSION" " +# echo "*************************************************************************************" +# if [ $log_size -lt 1800000 ]; +# then +# cat wheel_build_log +# else +# tail -100 wheel_build_log +# fi +# exit 1 +# else +# echo "Script execution completed successfully for "$PKG_DIR_PATH$BUILD_SCRIPT" "$VERSION" " +# echo "*************************************************************************************" +# if [ $log_size -lt 1800000 ]; +# then +# cat wheel_build_log +# else +# tail -100 wheel_build_log +# fi +# fi exit 0 diff --git a/gha-script/validate_builds.py b/gha-script/validate_builds.py index 7677b679e3..080175a5cf 100644 --- a/gha-script/validate_builds.py +++ b/gha-script/validate_builds.py @@ -11,8 +11,10 @@ -GITHUB_BUILD_SCRIPT_BASE_REPO = "build-scripts" -GITHUB_BUILD_SCRIPT_BASE_OWNER = "ppc64le" +#GITHUB_BUILD_SCRIPT_BASE_REPO = "build-scripts" +#GITHUB_BUILD_SCRIPT_BASE_OWNER = "ppc64le" +repo = os.environ.get("GITHUB_REPOSITORY") # +owner, repo_name = repo.split("/") HOME = os.getcwd() package_data = {} @@ -265,11 +267,12 @@ def validate_build_info_file(file_name): raise e def trigger_build_validation_ci(pr_number): - pull_request_file_url = "https://api.github.com/repos/{}/{}/pulls/{}/files".format( - GITHUB_BUILD_SCRIPT_BASE_OWNER, - GITHUB_BUILD_SCRIPT_BASE_REPO, - pr_number - ) + pull_request_file_url = f"https://api.github.com/repos/{owner}/{repo_name}/pulls/{pr_number}/files" + # pull_request_file_url = "https://api.github.com/repos/{}/{}/pulls/{}/files".format( + # GITHUB_BUILD_SCRIPT_BASE_OWNER, + # GITHUB_BUILD_SCRIPT_BASE_REPO, + # pr_number + # ) print(f"pull_request_file_url:{pull_request_file_url}" ) diff --git a/m/multidict/multidict_ubi_9.3.sh b/m/multidict/multidict_ubi_9.3.sh index a04566de57..415ce87274 100644 --- a/m/multidict/multidict_ubi_9.3.sh +++ b/m/multidict/multidict_ubi_9.3.sh @@ -18,6 +18,7 @@ # # --------------------------------------------------------------------------- + # Variables PACKAGE_NAME=multidict PACKAGE_VERSION=${1:-v6.0.2}