Skip to content

Commit 3369f83

Browse files
authored
PYCO-17: Finalize Publishing (#37)
Changes ======= * Update CI to publish to PyPI * Update CI to verify published package
1 parent 129a1d6 commit 3369f83

File tree

2 files changed

+198
-36
lines changed

2 files changed

+198
-36
lines changed

.github/workflows/publish.yml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,12 @@ jobs:
201201
&& needs.output-publish-params.result == 'success'
202202
&& needs.output-publish-params.outputs.publish_test_pypi == 'true'
203203
runs-on: ubuntu-22.04
204-
environment: publish
205-
# permissions:
206-
# # This permission is required for pypi's "trusted publisher" feature
207-
# id-token: write
204+
environment:
205+
name: publish
206+
url: https://pypi.org/p/couchbase-columnar
207+
permissions:
208+
# This permission is required for pypi's "trusted publisher" feature
209+
id-token: write
208210
steps:
209211
- uses: actions/download-artifact@v4
210212
if: ${{ inputs.wheels_run_id == '' }}
@@ -244,6 +246,10 @@ jobs:
244246
run: |
245247
ls -alh dist
246248
twine check dist/*
249+
- name: Publish package distributions to TestPyPI
250+
uses: pypa/gh-action-pypi-publish@release/v1
251+
with:
252+
repository-url: https://test.pypi.org/legacy/
247253

248254

249255
validate-test-pypi:
@@ -270,7 +276,12 @@ jobs:
270276
&& needs.output-publish-params.result == 'success'
271277
&& needs.output-publish-params.outputs.publish_pypi == 'true'
272278
runs-on: ubuntu-22.04
273-
environment: publish
279+
environment:
280+
name: publish
281+
url: https://pypi.org/p/couchbase-columnar
282+
permissions:
283+
# This permission is required for pypi's "trusted publisher" feature
284+
id-token: write
274285
steps:
275286
- uses: actions/download-artifact@v4
276287
if: ${{ inputs.wheels_run_id == '' }}
@@ -310,6 +321,8 @@ jobs:
310321
run: |
311322
ls -alh dist
312323
twine check dist/*
324+
- name: Publish package distributions to PyPI
325+
uses: pypa/gh-action-pypi-publish@release/v1
313326

314327

315328
validate-pypi:
@@ -330,6 +343,9 @@ jobs:
330343
name: Publish SDK API docs
331344
needs: [upload-api-docs, validate-pypi]
332345
environment: publish
346+
# permissions:
347+
# id-token: write
348+
# contents: read
333349
if: |
334350
always()
335351
&& (needs.build-wheels.result == 'success' || needs.build-wheels.result == 'skipped')
@@ -342,7 +358,16 @@ jobs:
342358
uses: actions/download-artifact@v4
343359
with:
344360
name: pycbcc-api-docs
345-
- name: Publish API docs to S3
361+
# - name: Setup AWS Credentials
362+
# uses: aws-actions/configure-aws-credentials@v3
363+
# with:
364+
# role-to-assume: arn:aws:iam::786014483886:role/SDK_GHA
365+
# aws-region: us-west-1
366+
- name: Upload API docs to S3
346367
run: |
347-
export SPHINX_DIR=${{ github.workspace }}/html
348-
ls -alh $SPHINX_DIR
368+
ls -alh ./html
369+
export S3_URL="s3://docs.couchbase.com/sdk-api/columnar-python-client-$SDK_VERSION/"
370+
echo "publish command: aws s3 cp ./html $S3_URL --recursive --acl public-read"
371+
# aws s3 cp ./html s3://docs.couchbase.com/sdk-api/columnar-python-client-$SDK_VERSION/ --recursive --acl public-read
372+
env:
373+
SDK_VERSION: ${{ inputs.version }}

.github/workflows/verify_release.yml

Lines changed: 165 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ on:
4040
type: string
4141

4242

43+
env:
44+
DEFAULT_PYTHON: "3.8"
45+
46+
4347
jobs:
4448
validate-input:
4549
runs-on: ubuntu-22.04
@@ -82,8 +86,6 @@ jobs:
8286
8387
test-setup:
8488
runs-on: ubuntu-22.04
85-
outputs:
86-
install-cmd: ${{ inputs.packaging_index == 'TEST_PYPI' && steps.test-pypi-cmd.outputs.install_cmd && steps.pypi-cmd.outputs.install_cmd }}
8789
needs: validate-input
8890
steps:
8991
- name: Setup Python
@@ -105,24 +107,13 @@ jobs:
105107
mv test_config.ini pycbcc_test
106108
env:
107109
CI_SCRIPTS_URL: "https://raw.githubusercontent.com/couchbaselabs/sdkbuild-jenkinsfiles/master/python"
108-
- name: Create install command
109-
id: test-pypi-cmd
110-
if: ${{ inputs.packaging_index == 'TEST_PYPI'}}
111-
run: |
112-
export INSTALL_CMD='-i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple couchbase==$SDK_VERSION'
113-
echo "INSTALL_CMD=$INSTALL_CMD"
114-
echo "install_cmd=$INSTALL_CMD" >> $GITHUB_OUTPUT
115-
env:
116-
SDK_VERSION: ${{ inputs.version }}
117-
- name: Create install command
118-
id: pypi-cmd
119-
if: ${{ inputs.packaging_index == 'PYPI'}}
110+
- name: Download quick test script
120111
run: |
121-
export=INSTALL_CMD='couchbase==$SDK_VERSION'
122-
echo "INSTALL_CMD=$INSTALL_CMD"
123-
echo "install_cmd=$INSTALL_CMD" >> $GITHUB_OUTPUT
112+
cd pycbcc_test
113+
curl -o columnar_async_quick_test.py ${CI_SCRIPTS_URL}/release_smoke_tests/columnar_async_quick_test.py
114+
curl -o columnar_quick_test.py ${CI_SCRIPTS_URL}/release_smoke_tests/columnar_quick_test.py
124115
env:
125-
SDK_VERSION: ${{ inputs.version }}
116+
CI_SCRIPTS_URL: "https://raw.githubusercontent.com/couchbaselabs/sdkbuild-jenkinsfiles/master/python"
126117
- name: Upload test setup
127118
uses: actions/upload-artifact@v4
128119
with:
@@ -151,26 +142,172 @@ jobs:
151142
with:
152143
name: pycbcc-test-setup
153144
path: pycbcc
154-
- name: Download quick test script
155-
run: |
156-
cd pycbcc
157-
curl -o columnar_async_quick_test.py ${CI_SCRIPTS_URL}/release_smoke_tests/columnar_async_quick_test.py
158-
curl -o columnar_quick_test.py ${CI_SCRIPTS_URL}/release_smoke_tests/columnar_quick_test.py
159-
env:
160-
CI_SCRIPTS_URL: "https://raw.githubusercontent.com/couchbaselabs/sdkbuild-jenkinsfiles/master/python"
161-
- name: Run verification tests in docker
145+
- name: Run test PyPI verification tests in docker
146+
if: ${{ inputs.packaging_index == 'TEST_PYPI'}}
147+
uses: addnab/docker-run-action@v3
148+
with:
149+
image: python:${{ matrix.python-version }}-slim-bullseye
150+
options: >-
151+
--platform linux/${{ matrix.arch == 'aarch64' && 'arm64' || 'amd64'}}
152+
-v ${{ github.workspace }}/pycbcc:/pycbcc
153+
-e SDK_VERSION=${{ inputs.version }}
154+
run: |
155+
env
156+
python -m pip install --upgrade pip setuptools wheel
157+
python -m pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple couchbase-columnar==$SDK_VERSION -v -v -v
158+
python -m pip list
159+
cd pycbcc
160+
python columnar_quick_test.py
161+
python columnar_async_quick_test.py
162+
- name: Run PyPI verification tests in docker
163+
if: ${{ inputs.packaging_index == 'PYPI'}}
162164
uses: addnab/docker-run-action@v3
163165
with:
164166
image: python:${{ matrix.python-version }}-slim-bullseye
165167
options: >-
166168
--platform linux/${{ matrix.arch == 'aarch64' && 'arm64' || 'amd64'}}
167169
-v ${{ github.workspace }}/pycbcc:/pycbcc
168-
-e INSTALL_CMD=${{ needs.test-setup.outputs.install-cmd }}
170+
-e SDK_VERSION=${{ inputs.version }}
169171
run: |
170172
env
171173
python -m pip install --upgrade pip setuptools wheel
172-
python -m pip install $INSTALL_CMD -v -v -v
174+
python -m pip install couchbase-columnar==$SDK_VERSION -v -v -v
173175
python -m pip list
174176
cd pycbcc
175177
python columnar_quick_test.py
176178
python columnar_async_quick_test.py
179+
180+
verify-musllinux:
181+
needs: test-setup
182+
runs-on: ${{ matrix.os }}
183+
container:
184+
image: python:${{ matrix.python-version }}-alpine3.19
185+
strategy:
186+
fail-fast: false
187+
matrix:
188+
os: ['ubuntu-22.04']
189+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
190+
arch: ['x86_64']
191+
steps:
192+
- name: Download test setup
193+
uses: actions/download-artifact@v4
194+
with:
195+
name: pycbcc-test-setup
196+
path: pycbcc
197+
- name: Confirm Python version
198+
run: python -c "import sys; print(sys.version)"
199+
- name: Run test PyPI verification tests
200+
if: ${{ inputs.packaging_index == 'TEST_PYPI'}}
201+
run: |
202+
env
203+
python -m pip install --upgrade pip setuptools wheel
204+
python -m pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple couchbase-columnar==$SDK_VERSION -v -v -v
205+
python -m pip list
206+
cd pycbcc
207+
python columnar_quick_test.py
208+
python columnar_async_quick_test.py
209+
env:
210+
SDK_VERSION: ${{ inputs.version }}
211+
- name: Run PyPI verification tests
212+
if: ${{ inputs.packaging_index == 'PYPI'}}
213+
run: |
214+
env
215+
python -m pip install --upgrade pip setuptools wheel
216+
python -m pip install couchbase-columnar==$SDK_VERSION -v -v -v
217+
python -m pip list
218+
cd pycbcc
219+
python columnar_quick_test.py
220+
python columnar_async_quick_test.py
221+
env:
222+
SDK_VERSION: ${{ inputs.version }}
223+
224+
verify-macos:
225+
needs: test-setup
226+
runs-on: ${{ matrix.os }}
227+
strategy:
228+
fail-fast: false
229+
matrix:
230+
os: ["macos-13", "macos-14"]
231+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
232+
steps:
233+
- name: Setup Python ${{ matrix.python-version }}
234+
uses: actions/setup-python@v5
235+
with:
236+
python-version: ${{ matrix.python-version }}
237+
- name: Confirm Python version
238+
run: python -c "import sys; print(sys.version)"
239+
- name: Download test setup
240+
uses: actions/download-artifact@v4
241+
with:
242+
name: pycbcc-test-setup
243+
path: pycbcc
244+
- name: Run test PyPI verification tests
245+
if: ${{ inputs.packaging_index == 'TEST_PYPI'}}
246+
run: |
247+
env
248+
python -m pip install --upgrade pip setuptools wheel
249+
python -m pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple couchbase-columnar==$SDK_VERSION -v -v -v
250+
python -m pip list
251+
cd pycbcc
252+
python columnar_quick_test.py
253+
python columnar_async_quick_test.py
254+
env:
255+
SDK_VERSION: ${{ inputs.version }}
256+
- name: Run PyPI verification tests
257+
if: ${{ inputs.packaging_index == 'PYPI'}}
258+
run: |
259+
env
260+
python -m pip install --upgrade pip setuptools wheel
261+
python -m pip install couchbase-columnar==$SDK_VERSION -v -v -v
262+
python -m pip list
263+
cd pycbcc
264+
python columnar_quick_test.py
265+
python columnar_async_quick_test.py
266+
env:
267+
SDK_VERSION: ${{ inputs.version }}
268+
269+
verify-windows:
270+
needs: test-setup
271+
runs-on: ${{ matrix.os }}
272+
strategy:
273+
fail-fast: false
274+
matrix:
275+
os: ["windows-latest"]
276+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
277+
arch: ["AMD64"]
278+
steps:
279+
- name: Setup Python ${{ matrix.python-version }}
280+
uses: actions/setup-python@v5
281+
with:
282+
python-version: ${{ matrix.python-version }}
283+
- name: Confirm Python version
284+
run: python -c "import sys; print(sys.version)"
285+
- name: Download test setup
286+
uses: actions/download-artifact@v4
287+
with:
288+
name: pycbcc-test-setup
289+
path: pycbcc
290+
- name: Run test PyPI verification tests
291+
if: ${{ inputs.packaging_index == 'TEST_PYPI'}}
292+
run: |
293+
env
294+
python -m pip install --upgrade pip setuptools wheel
295+
python -m pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple couchbase-columnar==$env:SDK_VERSION -v -v -v
296+
python -m pip list
297+
cd pycbcc
298+
python columnar_quick_test.py
299+
python columnar_async_quick_test.py
300+
env:
301+
SDK_VERSION: ${{ inputs.version }}
302+
- name: Run PyPI verification tests
303+
if: ${{ inputs.packaging_index == 'PYPI'}}
304+
run: |
305+
env
306+
python -m pip install --upgrade pip setuptools wheel
307+
python -m pip install couchbase-columnar==$env:SDK_VERSION -v -v -v
308+
python -m pip list
309+
cd pycbcc
310+
python columnar_quick_test.py
311+
python columnar_async_quick_test.py
312+
env:
313+
SDK_VERSION: ${{ inputs.version }}

0 commit comments

Comments
 (0)