Skip to content

Commit 8c5e033

Browse files
committed
feat(ci): select proper postgis images
1 parent 3075257 commit 8c5e033

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

.github/workflows/tests.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,41 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17+
orchestrate:
18+
name: Orchestrate matrix from Docker Hub
19+
runs-on: ubuntu-latest
20+
outputs:
21+
postgis_tags: ${{ steps.prepare.outputs.postgis_tags }}
22+
steps:
23+
- name: Query Docker Hub tags and build matrix
24+
id: prepare
25+
run: |
26+
# https://www.postgresql.org/support/versioning/
27+
pg_targets='[14, 15, 16, 17, 18]'
28+
29+
tags=$(
30+
curl -s "https://hub.docker.com/v2/repositories/postgis/postgis/tags?page_size=100" |
31+
jq --compact-output '
32+
.results
33+
| map(.name) as $tags
34+
| '"$pg_targets"'
35+
| map(
36+
. as $target
37+
| $tags
38+
| map(select(test("^\($target)-\\d+\\.\\d+$")))[0]
39+
)
40+
'
41+
)
42+
43+
if [[ "$(echo "$tags" | jq 'length')" -ne "$(echo "$pg_targets" | jq 'length')" ]]; then
44+
echo "Error: Could not find tags for all PostgreSQL targets" >&2
45+
exit 1
46+
fi
47+
48+
echo "postgis_tags=$tags" >> $GITHUB_OUTPUT
1749
test:
1850
runs-on: ubuntu-latest
51+
needs: [orchestrate]
1952
services:
2053
postgis:
2154
image: postgis/postgis:${{matrix.pg}}
@@ -35,8 +68,7 @@ jobs:
3568
matrix:
3669
# https://ruby-lang.org/en/downloads/branches
3770
ruby: ['3.4', '3.3', '3.2']
38-
# https://www.postgresql.org/support/versioning/
39-
pg: [14-master, 15-master, 16-master, 17-master, 18-3.6-alpine]
71+
pg: ${{ fromJson(needs.orchestrate.outputs.postgis_tags) }}
4072
steps:
4173
- name: Set Up Actions
4274
uses: actions/checkout@v4

0 commit comments

Comments
 (0)