-
Notifications
You must be signed in to change notification settings - Fork 9
293 lines (281 loc) · 9.44 KB
/
package.yaml
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Package
on:
pull_request:
push:
branches:
- "*"
tags:
- "*-rc*"
concurrency:
group: ${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
permissions:
contents: write
packages: write
jobs:
source:
name: Source
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
- name: Build archive
run: |
rake dist
- uses: actions/upload-artifact@v3
with:
name: source
path: apache-arrow-flight-sql-postgresql-*.tar.gz
- name: Upload to release
if: |
github.ref_type == 'tag'
run: |
ruby \
-e 'print("## Apache Arrow Flight SQL adapter for PostgreSQL "); \
puts(ARGF.read.split(/^## Version /)[1]. \
gsub(/ {.+?}/, ""). \
gsub(/\[(.+?)\]\[.+?\]/) {$1})' \
doc/source/release-notes.md > release-note.md
rc=${GITHUB_REF_NAME#*-rc}
title="$(head -n1 release-note.md | sed -e 's/^## //') RC${rc}"
tail -n +2 release-note.md > release-note-without-version.md
gh release create ${GITHUB_REF_NAME} \
--prerelease \
--notes-file release-note-without-version.md \
--title "${title}" \
apache-arrow-flight-sql-postgresql-*.tar.gz
env:
GH_TOKEN: ${{ github.token }}
linux:
name: Linux
needs:
- source
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
target:
- "debian-bookworm-amd64-postgresql-15-pgdg"
- "ubuntu-jammy-amd64-postgresql-15-pgdg"
steps:
- uses: actions/checkout@v4
with:
repository: apache/arrow
path: arrow
- uses: actions/download-artifact@v3
with:
name: source
- name: Prepare
run: |
BASE_NAME=apache-arrow-flight-sql-postgresql
echo "BASE_NAME=${BASE_NAME}" >> $GITHUB_ENV
echo "ARROW_SOURCE=$(pwd)/arrow" >> $GITHUB_ENV
full_target=${{ matrix.target }}
# debian-bookworm-amd64-postgresql-15-pgdg ->
# postgresql-15-pgdg
PACKAGE=postgresql-${full_target#*-postgresql-}
echo "PACKAGE=${PACKAGE}" >> $GITHUB_ENV
# debian-bookworm-amd64-postgresql-15-pgdg ->
# debian-bookworm-amd64
PACKAGE_TARGET=${full_target%-postgresql-*}
echo "APT_TARGETS=${PACKAGE_TARGET}" >> $GITHUB_ENV
echo "YUM_TARGETS=${PACKAGE_TARGET}" >> $GITHUB_ENV
case ${PACKAGE_TARGET} in
almalinux-*)
echo "TASK_NAMESPACE=yum" >> $GITHUB_ENV
;;
debian-*|ubuntu-*)
echo "TASK_NAMESPACE=apt" >> $GITHUB_ENV
;;
esac
DISTRIBUTION=${PACKAGE_TARGET%%-*}
echo "DISTRIBUTION=${DISTRIBUTION}" >> $GITHUB_ENV
DISTRIBUTION_VERSION=${PACKAGE_TARGET#*-}
DISTRIBUTION_VERSION=${DISTRIBUTION_VERSION%-*}
echo "DISTRIBUTION_VERSION=${DISTRIBUTION_VERSION}" >> $GITHUB_ENV
ARCHITECTURE=${PACKAGE_TARGET##*-}
echo "ARCHITECTURE=${ARCHITECTURE}" >> $GITHUB_ENV
source_archive=$(echo ${BASE_NAME}-*.tar.gz)
VERSION=${source_archive#${BASE_NAME}-}
VERSION=${VERSION%.tar.gz}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Extract source archive
run: |
tar xf ${BASE_NAME}-${VERSION}.tar.gz
ln -s ${BASE_NAME}-${VERSION} ${BASE_NAME}
mv ${BASE_NAME}-${VERSION}.tar.gz ${BASE_NAME}/
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
- name: Login to GitHub Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build
run: |
pushd ${BASE_NAME}/package/${PACKAGE}
if [ "${GITHUB_REF_TYPE}" != "tag" ]; then
rake version:update
fi
rake docker:pull || :
rake --trace ${TASK_NAMESPACE}:build
popd
- name: Prepare artifacts
run: |
cp -a \
${BASE_NAME}/package/${PACKAGE}/${TASK_NAMESPACE}/repositories/${DISTRIBUTION} \
./
tar czf ${{ matrix.target }}.tar.gz ${DISTRIBUTION}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: |
${{ matrix.target }}.tar.gz
- name: Upload to release
if: |
github.ref_type == 'tag'
run: |
gh release upload --repo ${GITHUB_REPOSITORY} ${GITHUB_REF_NAME} \
${{ matrix.target }}.tar.gz
env:
GH_TOKEN: ${{ github.token }}
- name: Push Docker image
run: |
pushd ${BASE_NAME}/package/${PACKAGE}
rake docker:push || :
popd
- name: Test
run: |
pushd ${BASE_NAME}
docker run \
--rm \
--volume ${PWD}:/host \
${ARCHITECTURE}/${DISTRIBUTION}:${DISTRIBUTION_VERSION} \
/host/package/${TASK_NAMESPACE}/test.sh \
${VERSION} \
local \
package/${PACKAGE}/${TASK_NAMESPACE}/repositories
popd
verify-source:
name: Verify source on ${{ matrix.os }}
needs:
- source
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os:
- macos
- ubuntu
postgresql-version:
- "15"
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/apache-arrow-flight-sql-postgresql/Gemfile
steps:
- uses: actions/download-artifact@v3
with:
name: source
- name: Extract source archive
run: |
tar_gz=$(echo apache-arrow-flight-sql-postgresql-*.tar.gz)
tar xf ${tar_gz}
ln -s ${tar_gz%.tar.gz} apache-arrow-flight-sql-postgresql
- name: Install dependencies on Ubuntu
if: matrix.os == 'ubuntu'
run: |
sudo apt update
sudo apt install -y -V \
ca-certificates \
gpg \
lsb-release \
wget
os=$(lsb_release --id --short | tr 'A-Z' 'a-z')
code_name=$(lsb_release --codename --short)
apt_source_deb=apache-arrow-apt-source-latest-${code_name}.deb
wget https://apache.jfrog.io/artifactory/arrow/${os}/${apt_source_deb}
sudo apt install -y -V ./${apt_source_deb}
wget -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/pgdg.gpg --import -
(echo "Types: deb"; \
echo "URIs: http://apt.postgresql.org/pub/repos/apt"; \
echo "Suites: ${code_name}-pgdg"; \
echo "Components: main"; \
echo "Signed-By: /usr/share/keyrings/pgdg.gpg") | \
sudo tee /etc/apt/sources.list.d/pgdg.sources
sudo apt update
sudo apt -y -V purge '^postgresql'
sudo apt install -y -V \
libarrow-flight-sql-glib-dev \
libkrb5-dev \
meson \
ninja-build \
postgresql-${{ matrix.postgresql-version }} \
postgresql-server-dev-${{ matrix.postgresql-version }}
- name: Install dependencies on macOS
if: matrix.os == 'macos'
run: |
pushd apache-arrow-flight-sql-postgresql
sed \
-i '' \
-e 's/postgresql@[0-9]*/postgresql@${{ matrix.postgresql-version }}/g' \
Brewfile
brew update
brew bundle
echo "$(brew --prefix postgresql@${{ matrix.postgresql-version }})/bin" >> $GITHUB_PATH
popd
- uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
bundler-cache: true
cache-version: 1
- name: Run
run: |
pushd apache-arrow-flight-sql-postgresql
bundle exec dev/release/verify-rc.sh
popd
env:
TEST_DEFAULT: "0"
TEST_SOURCE: "1"
verify-binaries:
name: Verify binaries
if: >-
github.ref_type == 'tag'
needs:
- linux
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Run
run: |
version=${GITHUB_REF_NAME%-rc*}
rc=${GITHUB_REF_NAME#*-rc}
dev/release/verify-rc.sh ${version} ${rc}
env:
TEST_BINARIES: "1"
TEST_DEFAULT: "0"