diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 388419f..7010367 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -32,7 +32,6 @@ jobs: outputs: packages_selected: "${{ steps.package-selection.outputs.packages_selected }}" selected_packages: "${{ steps.package-selection.outputs.selected_packages }}" - build_matrix: "${{ steps.package-selection.outputs.build_matrix }}" greptimedb_selected: "${{ steps.package-selection.outputs.greptimedb_selected }}" steps: - name: Prepare Environment @@ -63,6 +62,18 @@ jobs: id: package-selection run: scripts/apk/ci-package-cache.sh prepare + - name: Validate selected package matrix + run: | + for package in ${ALPINE_PACKAGES}; do + case "${package}" in + seaweedfs|greptimedb|lavinmq|gitea|nifi|rclone-openrc) ;; + *) + printf 'selected package is missing from the CI build matrix: %s\n' "${package}" >&2 + exit 1 + ;; + esac + done + build: needs: preflight if: needs.preflight.outputs.packages_selected == 'true' @@ -70,7 +81,8 @@ jobs: timeout-minutes: 180 strategy: fail-fast: false - matrix: ${{ fromJSON(needs.preflight.outputs.build_matrix) }} + matrix: + package: [seaweedfs, greptimedb, lavinmq, gitea, nifi, rclone-openrc] container: image: "alpine:3.24" env: @@ -87,11 +99,13 @@ jobs: uses: actions/checkout@v3 - name: Build package + if: contains(needs.preflight.outputs.selected_packages, matrix.package) run: | scripts/apk/ci-build.sh scripts/apk/list-packages.sh - name: Check artifact upload support + if: contains(needs.preflight.outputs.selected_packages, matrix.package) run: | test -n "${ACTIONS_RUNTIME_TOKEN:-}" || { echo "artifact upload support is required for split package builds" >&2 @@ -99,6 +113,7 @@ jobs: } - name: Upload package artifacts + if: contains(needs.preflight.outputs.selected_packages, matrix.package) uses: actions/upload-artifact@v3 with: name: alpine-package-${{ matrix.package }}-${{ github.sha }} diff --git a/scripts/apk/ci-package-cache.sh b/scripts/apk/ci-package-cache.sh index ce90e4f..8117634 100755 --- a/scripts/apk/ci-package-cache.sh +++ b/scripts/apk/ci-package-cache.sh @@ -111,7 +111,7 @@ registry_upgrade_packages() { } prepare() { - local build_matrix selected + local selected declare -A selected_map=() download_registry_metadata @@ -138,9 +138,7 @@ prepare() { } >> "${GITHUB_ENV}" fi if [[ -n "${GITHUB_OUTPUT:-}" ]]; then - build_matrix="$({ printf '%s\n' "${ALPINE_PACKAGES}" | tr ' ' '\n' | jq -Rsc 'split("\n") | map(select(length > 0)) | {package: .}'; })" printf 'selected_packages=%s\n' "${ALPINE_PACKAGES}" >> "${GITHUB_OUTPUT}" - printf 'build_matrix=%s\n' "${build_matrix}" >> "${GITHUB_OUTPUT}" if [[ -n "${ALPINE_PACKAGES}" ]]; then printf 'packages_selected=true\n' >> "${GITHUB_OUTPUT}" else