Skip to content

Commit de59e30

Browse files
committed
Fix release workflow
Install Kerberos deps when testing wheels and make cibuildwheel tests run properly.
1 parent f6ec755 commit de59e30

File tree

4 files changed

+113
-57
lines changed

4 files changed

+113
-57
lines changed

.github/workflows/install-krb5.sh

+36-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,41 @@
11
#!/bin/bash
22

33
set -Eexuo pipefail
4+
shopt -s nullglob
45

5-
if [ "$RUNNER_OS" == "Linux" ]; then
6-
# Assume Ubuntu since this is the only Linux used in CI.
7-
sudo apt-get update
8-
sudo apt-get install -y --no-install-recommends \
9-
libkrb5-dev krb5-user krb5-kdc krb5-admin-server
6+
if [[ $OSTYPE == linux* ]]; then
7+
if [ "$(id -u)" = "0" ]; then
8+
SUDO=
9+
else
10+
SUDO=sudo
11+
fi
12+
13+
if [ -e /etc/os-release ]; then
14+
source /etc/os-release
15+
elif [ -e /etc/centos-release ]; then
16+
ID="centos"
17+
VERSION_ID=$(cat /etc/centos-release | cut -f3 -d' ' | cut -f1 -d.)
18+
else
19+
echo "install-krb5.sh: cannot determine which Linux distro this is" >&2
20+
exit 1
21+
fi
22+
23+
if [ "${ID}" = "debian" -o "${ID}" = "ubuntu" ]; then
24+
export DEBIAN_FRONTEND=noninteractive
25+
26+
$SUDO apt-get update
27+
$SUDO apt-get install -y --no-install-recommends \
28+
libkrb5-dev krb5-user krb5-kdc krb5-admin-server
29+
elif [ "${ID}" = "almalinux" ]; then
30+
$SUDO dnf install -y krb5-server krb5-workstation krb5-libs krb5-devel
31+
elif [ "${ID}" = "centos" ]; then
32+
$SUDO yum install -y krb5-server krb5-workstation krb5-libs krb5-devel
33+
elif [ "${ID}" = "alpine" ]; then
34+
$SUDO apk add krb5 krb5-server krb5-dev
35+
else
36+
echo "install-krb5.sh: Unsupported linux distro: ${distro}" >&2
37+
exit 1
38+
fi
39+
else
40+
echo "install-krb5.sh: unsupported OS: ${OSTYPE}" >&2
1041
fi

.github/workflows/install-postgres.sh

+51-43
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,59 @@
33
set -Eexuo pipefail
44
shopt -s nullglob
55

6-
PGVERSION=${PGVERSION:-12}
6+
if [[ $OSTYPE == linux* ]]; then
7+
PGVERSION=${PGVERSION:-12}
78

8-
if [ -e /etc/os-release ]; then
9-
source /etc/os-release
10-
elif [ -e /etc/centos-release ]; then
11-
ID="centos"
12-
VERSION_ID=$(cat /etc/centos-release | cut -f3 -d' ' | cut -f1 -d.)
13-
else
14-
echo "install-postgres.sh: cannot determine which Linux distro this is" >&2
15-
exit 1
16-
fi
9+
if [ -e /etc/os-release ]; then
10+
source /etc/os-release
11+
elif [ -e /etc/centos-release ]; then
12+
ID="centos"
13+
VERSION_ID=$(cat /etc/centos-release | cut -f3 -d' ' | cut -f1 -d.)
14+
else
15+
echo "install-postgres.sh: cannot determine which Linux distro this is" >&2
16+
exit 1
17+
fi
18+
19+
if [ "${ID}" = "debian" -o "${ID}" = "ubuntu" ]; then
20+
export DEBIAN_FRONTEND=noninteractive
1721

18-
if [ "${ID}" = "debian" -o "${ID}" = "ubuntu" ]; then
19-
export DEBIAN_FRONTEND=noninteractive
20-
21-
apt-get install -y --no-install-recommends curl gnupg ca-certificates
22-
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
23-
mkdir -p /etc/apt/sources.list.d/
24-
echo "deb https://apt.postgresql.org/pub/repos/apt/ ${VERSION_CODENAME}-pgdg main" \
25-
>> /etc/apt/sources.list.d/pgdg.list
26-
apt-get update
27-
apt-get install -y --no-install-recommends \
28-
"postgresql-${PGVERSION}" \
29-
"postgresql-contrib-${PGVERSION}"
30-
elif [ "${ID}" = "almalinux" ]; then
31-
yum install -y \
32-
"postgresql-server" \
33-
"postgresql-devel" \
34-
"postgresql-contrib"
35-
elif [ "${ID}" = "centos" ]; then
36-
el="EL-${VERSION_ID%.*}-$(arch)"
37-
baseurl="https://download.postgresql.org/pub/repos/yum/reporpms"
38-
yum install -y "${baseurl}/${el}/pgdg-redhat-repo-latest.noarch.rpm"
39-
if [ ${VERSION_ID%.*} -ge 8 ]; then
40-
dnf -qy module disable postgresql
22+
apt-get install -y --no-install-recommends curl gnupg ca-certificates
23+
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
24+
mkdir -p /etc/apt/sources.list.d/
25+
echo "deb https://apt.postgresql.org/pub/repos/apt/ ${VERSION_CODENAME}-pgdg main" \
26+
>> /etc/apt/sources.list.d/pgdg.list
27+
apt-get update
28+
apt-get install -y --no-install-recommends \
29+
"postgresql-${PGVERSION}" \
30+
"postgresql-contrib-${PGVERSION}"
31+
elif [ "${ID}" = "almalinux" ]; then
32+
yum install -y \
33+
"postgresql-server" \
34+
"postgresql-devel" \
35+
"postgresql-contrib"
36+
elif [ "${ID}" = "centos" ]; then
37+
el="EL-${VERSION_ID%.*}-$(arch)"
38+
baseurl="https://download.postgresql.org/pub/repos/yum/reporpms"
39+
yum install -y "${baseurl}/${el}/pgdg-redhat-repo-latest.noarch.rpm"
40+
if [ ${VERSION_ID%.*} -ge 8 ]; then
41+
dnf -qy module disable postgresql
42+
fi
43+
yum install -y \
44+
"postgresql${PGVERSION}-server" \
45+
"postgresql${PGVERSION}-contrib"
46+
ln -s "/usr/pgsql-${PGVERSION}/bin/pg_config" "/usr/local/bin/pg_config"
47+
elif [ "${ID}" = "alpine" ]; then
48+
apk add shadow postgresql postgresql-dev postgresql-contrib
49+
else
50+
echo "install-postgres.sh: unsupported Linux distro: ${distro}" >&2
51+
exit 1
4152
fi
42-
yum install -y \
43-
"postgresql${PGVERSION}-server" \
44-
"postgresql${PGVERSION}-contrib"
45-
ln -s "/usr/pgsql-${PGVERSION}/bin/pg_config" "/usr/local/bin/pg_config"
46-
elif [ "${ID}" = "alpine" ]; then
47-
apk add shadow postgresql postgresql-dev postgresql-contrib
53+
54+
useradd -m -s /bin/bash apgtest
55+
56+
elif [[ $OSTYPE == darwin* ]]; then
57+
brew install postgresql
58+
4859
else
49-
echo "install-postgres.sh: Unsupported distro: ${distro}" >&2
50-
exit 1
60+
echo "install-postgres.sh: unsupported OS: ${OSTYPE}" >&2
5161
fi
52-
53-
useradd -m -s /bin/bash apgtest

.github/workflows/release.yml

+21-8
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ jobs:
3939
4040
- uses: actions/upload-artifact@v4
4141
with:
42-
name: dist
43-
path: dist/
42+
name: dist-version
43+
path: dist/VERSION
4444

4545
build-sdist:
4646
needs: validate-release-request
@@ -67,7 +67,7 @@ jobs:
6767
6868
- uses: actions/upload-artifact@v4
6969
with:
70-
name: dist
70+
name: dist-sdist
7171
path: dist/*.tar.*
7272

7373
build-wheels-matrix:
@@ -127,9 +127,19 @@ jobs:
127127

128128
- uses: actions/upload-artifact@v4
129129
with:
130-
name: dist
130+
name: dist-wheels-${{ matrix.only }}
131131
path: wheelhouse/*.whl
132132

133+
merge-artifacts:
134+
runs-on: ubuntu-latest
135+
needs: [build-sdist, build-wheels]
136+
steps:
137+
- name: Merge Artifacts
138+
uses: actions/upload-artifact/merge@v4
139+
with:
140+
name: dist
141+
delete-merged: true
142+
133143
publish-docs:
134144
needs: [build-sdist, build-wheels]
135145
runs-on: ubuntu-latest
@@ -180,6 +190,12 @@ jobs:
180190
needs: [build-sdist, build-wheels, publish-docs]
181191
runs-on: ubuntu-latest
182192

193+
environment:
194+
name: pypi
195+
url: https://pypi.org/p/asyncpg
196+
permissions:
197+
id-token: write
198+
183199
steps:
184200
- uses: actions/checkout@v4
185201
with:
@@ -223,7 +239,4 @@ jobs:
223239
- name: Upload to PyPI
224240
uses: pypa/gh-action-pypi-publish@release/v1
225241
with:
226-
user: __token__
227-
password: ${{ secrets.PYPI_TOKEN }}
228-
# password: ${{ secrets.TEST_PYPI_TOKEN }}
229-
# repository_url: https://test.pypi.org/legacy/
242+
attestations: true

pyproject.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,17 @@ build-frontend = "build"
7575
test-extras = "test"
7676

7777
[tool.cibuildwheel.macos]
78+
before-all = ".github/workflows/install-postgres.sh"
7879
test-command = "python {project}/tests/__init__.py"
7980

8081
[tool.cibuildwheel.windows]
8182
test-command = "python {project}\\tests\\__init__.py"
8283

8384
[tool.cibuildwheel.linux]
84-
before-all = ".github/workflows/install-postgres.sh"
85+
before-all = """
86+
.github/workflows/install-postgres.sh \
87+
&& .github/workflows/install-krb5.sh \
88+
"""
8589
test-command = """\
8690
PY=`which python` \
8791
&& chmod -R go+rX "$(dirname $(dirname $(dirname $PY)))" \

0 commit comments

Comments
 (0)