diff --git a/.github/workflows/PackageMatrix.yml b/.github/workflows/PackageMatrix.yml index 97fb5b22..d453c725 100644 --- a/.github/workflows/PackageMatrix.yml +++ b/.github/workflows/PackageMatrix.yml @@ -76,7 +76,7 @@ jobs: runs-on: ubuntu-latest outputs: - matrix: ${{ steps.filter-matrix.outputs.matrix || steps.set-packages.outputs.matrix }} + matrix: ${{ steps.clean-matrix.outputs.matrix }} steps: - name: Checkout repository @@ -171,3 +171,50 @@ jobs: echo "::endgroup::" echo "" echo "matrix=$OUTPUT" >> "$GITHUB_OUTPUT" + + - name: Clean matrix if no packages found + id: clean-matrix + shell: bash + env: + MATRIX: ${{ steps.filter-matrix.outputs.matrix || steps.set-packages.outputs.matrix }} + DEFAULT_CONFIG: ${{ inputs.default-config }} + run: | + echo "Checking if matrix has any packages..." + + # Check if packages array is empty + PACKAGES_COUNT=$(echo "$MATRIX" | jq '.packages | length') + + echo "Packages count: $PACKAGES_COUNT" + + if [ "$PACKAGES_COUNT" -eq 0 ]; then + echo "No packages found - removing default-config dimensions and packages, keeping include only" + # Keep only include, remove packages and all default-config dimensions + OUTPUT=$(echo "$MATRIX" | jq '{include: .include}') + else + echo "Packages found - keeping matrix as-is" + OUTPUT="$MATRIX" + fi + + # Remove include if it's an empty array (regardless of packages count) + INCLUDE_COUNT=$(echo "$OUTPUT" | jq '.include | length') + echo "Include count: $INCLUDE_COUNT" + + if [ "$INCLUDE_COUNT" -eq 0 ]; then + echo "Include array is empty - removing it" + OUTPUT=$(echo "$OUTPUT" | jq 'del(.include)') + fi + + # Check if we have an empty JSON object and return empty string instead + OBJECT_KEYS=$(echo "$OUTPUT" | jq 'keys | length') + if [ "$OBJECT_KEYS" -eq 0 ]; then + echo "Matrix is completely empty - returning empty string" + OUTPUT='' + fi + + echo "::group::Final matrix JSON" + echo "$OUTPUT" | jq . + echo "::endgroup::" + echo "" + # Ensure compact JSON output for GitHub Actions + COMPACT_OUTPUT=$(echo "$OUTPUT" | jq -c .) + echo "matrix=$COMPACT_OUTPUT" >> "$GITHUB_OUTPUT" diff --git a/.sync/Files.yml b/.sync/Files.yml index 7d9d24d4..5429162e 100644 --- a/.sync/Files.yml +++ b/.sync/Files.yml @@ -646,7 +646,7 @@ group: repos: | microsoft/mu_crypto_release -# Leaf Workflow - CLANGPDB Package CI (feature repos) +# Leaf Workflow - CLANGPDB Package CI (mu_feature_config and mu_feature_dfci) - files: - source: .sync/workflows/leaf/clangpdb-ci.yml dest: .github/workflows/clangpdb-ci.yml @@ -655,11 +655,20 @@ group: setup_cmd: both repos: | microsoft/mu_feature_config - microsoft/mu_feature_debugger microsoft/mu_feature_dfci + +# Leaf Workflow - CLANGPDB Package CI (mu_feature_ipmi and mu_feature_debugger) + - files: + - source: .sync/workflows/leaf/clangpdb-ci.yml + dest: .github/workflows/clangpdb-ci.yml + template: + branch: main + setup_cmd: ci-setup + repos: | microsoft/mu_feature_ipmi + microsoft/mu_feature_debugger -# Leaf Workflow - CLANGPDB Package CI (mu_oem_sample, mu_plus) +# Leaf Workflow - CLANGPDB Package CI (mu_oem_sample) - files: - source: .sync/workflows/leaf/clangpdb-ci.yml dest: .github/workflows/clangpdb-ci.yml @@ -667,7 +676,6 @@ group: setup_cmd: ci-setup repos: | microsoft/mu_oem_sample - microsoft/mu_plus # Leaf Workflow - CLANGPDB Package CI (mu_tiano_platforms) - files: diff --git a/.sync/Version.njk b/.sync/Version.njk index e26492ef..3818191d 100644 --- a/.sync/Version.njk +++ b/.sync/Version.njk @@ -30,7 +30,7 @@ #} {# The git ref value that files dependent on this repo will use. #} -{% set mu_devops = "v18.0.4" %} +{% set mu_devops = "v18.0.5" %} {# The latest Project Mu release branch value. #} {% set latest_mu_release_branch = "release/202511" %}