Skip to content

Commit 8add7aa

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

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

.github/workflows/tests.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,37 @@ 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
34+
| select(test("master|latest")|not)
35+
) as $tags
36+
| '"$pg_targets"'
37+
| map(
38+
. as $target
39+
| $tags
40+
| map(select(test("^\($target)-")))[0]
41+
)
42+
'
43+
)
44+
echo "postgis_tags=$tags" >> $GITHUB_OUTPUT
1745
test:
1846
runs-on: ubuntu-latest
47+
needs: [orchestrate]
1948
services:
2049
postgis:
2150
image: postgis/postgis:${{matrix.pg}}
@@ -35,8 +64,7 @@ jobs:
3564
matrix:
3665
# https://ruby-lang.org/en/downloads/branches
3766
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]
67+
pg: ${{ fromJson(needs.orchestrate.outputs.postgis_tags) }}
4068
steps:
4169
- name: Set Up Actions
4270
uses: actions/checkout@v4

0 commit comments

Comments
 (0)