|
9 | 9 | # paths: [] |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - dummy: |
| 12 | + # The set of paths for changed files (eg: airflow/Dockerfile, zookeeper/stackable/jmx/server.yaml) |
| 13 | + # ... limited to the product-paths (eg: airflow, zookeeper) that have a versions.py |
| 14 | + # Then for each _product_, shard based on product versions that have the "test" indicator |
| 15 | + generate_matrix: |
| 16 | + name: Generate Products and Versions Matrix |
13 | 17 | runs-on: ubuntu-latest |
14 | 18 | steps: |
15 | | - - run: echo TODO |
| 19 | + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 20 | + - id: shard |
| 21 | + shell: bash |
| 22 | + run: | |
| 23 | + set -euo pipefail |
| 24 | + [ -n "$GITHUB_DEBUG" ] && set -x |
| 25 | +
|
| 26 | + PRODUCT_VERSION_PAIRS=$( |
| 27 | + # shellcheck disable=SC2016 |
| 28 | + git diff --name-only \ |
| 29 | + | cut --delimiter=/ --fields=1 | xargs -I {} find {} -type f -maxdepth 1 -name versions.toml \ |
| 30 | + | xargs -r dirname \ |
| 31 | + | xargs -I {} tomlq --raw-output --arg product "{}" '{$product: .versions | map_values(select(.build_on_pr)) | keys[]}' {}/versions.toml \ |
| 32 | + | jq --slurp --compact-output '.' |
| 33 | + ) |
| 34 | + echo "product_version_pairs=$PRODUCT_VERSION_PAIRS" | tee -a "$GITHUB_OUTPUT" |
| 35 | +
|
| 36 | + outputs: |
| 37 | + product_version_pairs: ${{ steps.shard.outputs.product_version_pairs }} |
| 38 | + |
| 39 | + build: |
| 40 | + name: Build/Publish ${{ matrix.product_version_pairs.name }}-${{ matrix.product_version_pairs.version }}-${{ matrix.runner.arch }} Image |
| 41 | + needs: [generate_matrix] |
| 42 | + permissions: |
| 43 | + id-token: write |
| 44 | + runs-on: ${{ matrix.runner.name }} |
| 45 | + strategy: |
| 46 | + matrix: |
| 47 | + runner: |
| 48 | + - {name: "ubuntu-latest", arch: "amd64"} |
| 49 | + - {name: "ubicloud-standard-8-arm", arch: "arm64"} |
| 50 | + # Eg: [{"name":"airflow","version":"2.10.2"},{"name":"airflow","version":"2.9.3"},{"name":"zookeeper","version":"3.9.2"}] |
| 51 | + product_version_pairs: ${{ fromJson(needs.generate_matrix.outputs.product_version_pairs) }} |
| 52 | + steps: |
| 53 | + - name: Checkout Repository |
| 54 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 55 | + - env: |
| 56 | + PRODUCT_NAME: ${{ matrix.product_version_pairs.name }} |
| 57 | + PRODUCT_VERSION: ${{ matrix.product_version_pairs.version }} |
| 58 | + run: | |
| 59 | + echo "PRODUCT_NAME=$PRODUCT_NAME" |
| 60 | + echo "PRODUCT_VERSION=$PRODUCT_VERSION" |
0 commit comments