-
Notifications
You must be signed in to change notification settings - Fork 10
100 lines (100 loc) · 2.67 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Test
on:
push:
paths:
- '.github/workflows/test.yml'
pull_request:
paths:
- '.github/workflows/test.yml'
schedule:
- cron: |
0 0 * * *
workflow_dispatch:
concurrency:
group: test
cancel-in-progress: true
jobs:
run:
name: ${{ matrix.id }}
if: |
!startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
id:
- "alpine-17"
- "alpine-16"
- "alpine-15"
- "alpine-14"
- "alpine-13"
- "alpine-12"
- "alpine-17-slim"
- "alpine-16-slim"
- "alpine-15-slim"
- "alpine-14-slim"
- "alpine-13-slim"
- "alpine-12-slim"
- "debian-17"
- "debian-16"
- "debian-15"
- "debian-14"
- "debian-13"
- "debian-12"
steps:
- name: Install dependencies
run: |
sudo apt -u -V install \
curl \
jq \
postgresql-client
- name: Detect the latest release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -o pipefail
curl \
--header "Accept: application/vnd.github+json" \
--header "Authorization: Bearer ${GH_TOKEN}" \
--fail-with-body \
https://api.github.com/repos/pgroonga/pgroonga/releases/latest | \
tee releases.json
latest_version=$(jq -r .tag_name releases.json)
echo "LATEST_VERSION=${latest_version}" >> ${GITHUB_ENV}
- name: Check PGroonga version
env:
PGPASSWORD: pgroonga
run: |
tag="${LATEST_VERSION}-${{ matrix.id }}"
docker_image="groonga/pgroonga:${tag}"
docker run \
-d \
-e POSTGRES_DB=pgroonga \
-e POSTGRES_PASSWORD=${PGPASSWORD} \
-e POSTGRES_USER=pgroonga \
-p 127.0.0.1:5432:5432 \
${docker_image}
for i in {1..60}; do
if pg_isready -h 127.0.0.1; then
break
fi
sleep 1
done
if [ $i -eq 60 ]; then
echo "PostgreSQL isn't available"
exit 1
fi
psql \
-h 127.0.0.1 \
-U pgroonga \
-c "CREATE EXTENSION pgroonga;"
pgroonga_version=$( \
psql \
-h 127.0.0.1 \
-U pgroonga \
-t \
-A \
-c "SELECT extversion FROM pg_catalog.pg_extension WHERE extname = 'pgroonga';" \
)
set -x
[ "${LATEST_VERSION}" = "${pgroonga_version}" ]