|
5 | 5 | branches: |
6 | 6 | - all-citus-test-installation-workflow |
7 | 7 | workflow_dispatch: |
8 | | - inputs: |
9 | | - pg_major_version: |
10 | | - description: "PostgreSQL major version (e.g., 18)" |
11 | | - required: true |
12 | | - type: string |
13 | | - citus_major_minor_version: |
14 | | - description: "Citus major.minor version (e.g., 14.0)" |
15 | | - required: true |
16 | | - type: string |
17 | 8 |
|
18 | 9 | env: |
19 | | - # Branch whose build-package.yml defines the canonical platform list |
| 10 | + # Branch whose build-package.yml and postgres-matrix.yml are the source of truth |
20 | 11 | SOURCE_BRANCH: "all-citus" |
21 | | - PG_MAJOR_VERSION: ${{ inputs.pg_major_version || '18' }} |
22 | | - CITUS_MAJOR_MINOR_VERSION: ${{ inputs.citus_major_minor_version || '14.0' }} |
23 | 12 |
|
24 | 13 | jobs: |
25 | | - discover_platforms: |
26 | | - name: Discover supported platforms |
| 14 | + discover: |
| 15 | + name: Discover platforms & versions |
27 | 16 | runs-on: ubuntu-latest |
28 | 17 | outputs: |
29 | | - matrix: ${{ steps.extract.outputs.matrix }} |
| 18 | + matrix: ${{ steps.build_matrix.outputs.matrix }} |
| 19 | + citus_version: ${{ steps.resolve_versions.outputs.citus_version }} |
30 | 20 | steps: |
31 | 21 | - name: Checkout repository |
32 | 22 | uses: actions/checkout@v4 |
33 | 23 |
|
34 | | - - name: Extract platform list from build-package.yml |
35 | | - id: extract |
| 24 | + - name: Fetch source branch |
| 25 | + run: git fetch origin "${SOURCE_BRANCH}" --depth=1 |
| 26 | + |
| 27 | + - name: Extract platform list |
| 28 | + id: extract_platforms |
36 | 29 | run: | |
37 | | - # Fetch only the all-citus branch (shallow) to read its build-package.yml |
38 | | - git fetch origin "${SOURCE_BRANCH}" --depth=1 |
39 | 30 | git show "origin/${SOURCE_BRANCH}:.github/workflows/build-package.yml" \ |
40 | 31 | > /tmp/build-package.yml |
41 | 32 |
|
42 | | - # Pull the platform array and compact it into a single-line JSON string |
43 | 33 | platforms=$( |
44 | 34 | yq -o=json '.jobs.build_package.strategy.matrix.platform' /tmp/build-package.yml \ |
45 | 35 | | jq -c '.' |
46 | 36 | ) |
47 | 37 |
|
48 | 38 | echo "Discovered platforms: ${platforms}" |
49 | | - echo "matrix={\"platform\": ${platforms}}" >> "$GITHUB_OUTPUT" |
| 39 | + echo "platforms=${platforms}" >> "$GITHUB_OUTPUT" |
| 40 | +
|
| 41 | + - name: Resolve Citus & PG versions from postgres-matrix.yml |
| 42 | + id: resolve_versions |
| 43 | + run: | |
| 44 | + git show "origin/${SOURCE_BRANCH}:postgres-matrix.yml" > /tmp/postgres-matrix.yml |
| 45 | +
|
| 46 | + # Latest entry = last element in version_matrix |
| 47 | + citus_version=$(yq '.version_matrix[-1] | keys | .[0]' /tmp/postgres-matrix.yml) |
| 48 | +
|
| 49 | + pg_versions=$( |
| 50 | + yq -o=json \ |
| 51 | + ".version_matrix[-1].\"${citus_version}\".postgres_versions" \ |
| 52 | + /tmp/postgres-matrix.yml \ |
| 53 | + | jq -c '[.[] | tostring]' |
| 54 | + ) |
| 55 | +
|
| 56 | + echo "Latest Citus version: ${citus_version}" |
| 57 | + echo "Supported PG versions: ${pg_versions}" |
| 58 | + echo "citus_version=${citus_version}" >> "$GITHUB_OUTPUT" |
| 59 | + echo "pg_versions=${pg_versions}" >> "$GITHUB_OUTPUT" |
| 60 | +
|
| 61 | + - name: Build matrix |
| 62 | + id: build_matrix |
| 63 | + run: | |
| 64 | + matrix=$(jq -cn \ |
| 65 | + --argjson platforms '${{ steps.extract_platforms.outputs.platforms }}' \ |
| 66 | + --argjson pg_versions '${{ steps.resolve_versions.outputs.pg_versions }}' \ |
| 67 | + '{"platform": $platforms, "pg_version": $pg_versions}') |
| 68 | + echo "Matrix: ${matrix}" |
| 69 | + echo "matrix=${matrix}" >> "$GITHUB_OUTPUT" |
50 | 70 |
|
51 | 71 | test_package: |
52 | | - name: "Test ${{ matrix.platform }}" |
53 | | - needs: discover_platforms |
| 72 | + name: "Test ${{ matrix.platform }} / PG ${{ matrix.pg_version }}" |
| 73 | + needs: discover |
54 | 74 | runs-on: ubuntu-latest |
55 | 75 | strategy: |
56 | 76 | fail-fast: false |
57 | | - matrix: ${{ fromJson(needs.discover_platforms.outputs.matrix) }} |
| 77 | + matrix: ${{ fromJson(needs.discover.outputs.matrix) }} |
58 | 78 | steps: |
59 | 79 | - name: Checkout repository |
60 | 80 | uses: actions/checkout@v4 |
|
68 | 88 | run: | |
69 | 89 | python3 test_package_installation/run_test.py \ |
70 | 90 | "${{ matrix.platform }}" \ |
71 | | - "${PG_MAJOR_VERSION}" \ |
72 | | - "${CITUS_MAJOR_MINOR_VERSION}" |
| 91 | + "${{ matrix.pg_version }}" \ |
| 92 | + "${{ needs.discover.outputs.citus_version }}" |
0 commit comments