Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 180 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
name: Release
on:
push:
branches:
- default
# To simplify the release process, the publishing is triggered on tag.
# We should make sure to only push tags for new releases.
# If we start using tags for non-release purposes,
# this needs to be updated.
#
# We need to explicitly configure an expression that matches anything.
tags: [ "**" ]
pull_request:


# Cancel any in-progress runs for the same ref (branch or tag)
# If a build is in progress and a new commit is pushed to the same branch,
# the in-progress build is cancelled and only the latest build runs.
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true


env:
LINUX_URL: "https://bin.chevah.com:20443/third-party-stuff/ibm-mqc-redist/9.4.4.0-IBM-MQC-Redist-LinuxX64.tar.gz"
WINDOWS_URL: "https://bin.chevah.com:20443/third-party-stuff/ibm-mqc-redist/9.4.4.0-IBM-MQC-Redist-Win64.zip"

defaults:
run:
# Use bash on Windows for consistency.
shell: bash


jobs:
build_wheels:
name: Build ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.9'

- name: Install deps
run: |
python -m pip install -r tools/requirements-dev.txt

- name: Get IBM MQ C Linux Redistributables
if: matrix.runs-on == 'ubuntu-latest'
run: |
python tools/getRedistributables.py "$LINUX_URL" ibm-mq-c

- name: Get IBM MQ C Windows Redistributables
if: matrix.runs-on == 'windows-latest'
run: |
python tools/getRedistributables.py "$WINDOWS_URL" ibm-mq-c

- name: Build ibmmq wheels
run: |
export MQ_FILE_PATH=`pwd`/ibm-mq-c
python -m build --wheel

- name: Build C redistributables wheels
run: |
export MQ_FILE_PATH=`pwd`/ibm-mq-c
python -m build --wheel code/mqcredist
mv code/mqcredist/dist/*.whl dist/

- name: Check files
run: ls -al dist/

- name: Audit ABI3 wheels
run: |
abi3audit -vsS dist/*.whl

- uses: actions/upload-artifact@v4
with:
name: artifact-wheels-${{ matrix.runs-on }}
path: ./dist/*.whl


build_sdist:
name: Build source distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.9'

- name: Install build
run: |
python -m pip install build

- name: Build sdist and NOOP wheels
run: python -m build

- name: Build NOOP redistributables wheels
run: |
python -m build --wheel code/mqcredist
mv code/mqcredist/dist/*.whl dist/

- uses: actions/upload-artifact@v4
with:
name: artifact-sdist
path: dist/*


upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest

# services:
# # Start an IBM MQ server similar to the one
# # from code/tests/runContainer.sh
# mq-server:
# image: icr.io/ibm-messaging/mq:latest
# env:
# LICENSE: accept
# MQ_QMGR_NAME: QM1
# MQ_ENABLE_EMBEDDED_WEB_SERVER: false
# AMQ_IODELAY: 5000000
# MQ_APP_PASSWORD: mqAppPassword
# volumes:
# - code/tests/pki/mykey:/etc/mqm/pki/keys/mykey
# ports:
# # We don't open 9443 as this is for admin purposes.
# - 1414:1414

permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

steps:
- uses: actions/download-artifact@v4
with:
pattern: artifact-*
merge-multiple: true
path: dist

- name: Check files
run: |
ls -al dist/
export

# Run a minimal test to verify the package can connect to IBM MQ.
# - uses: actions/checkout@v4

# - uses: actions/setup-python@v4
# name: Install Python
# with:
# python-version: '3.9'

# - name: Run minimal IBM MQ test
# env:
# PY_IBMMQ_TEST_TLS_SKIP: 0
# PY_IBMMQ_TEST_TLS_KEY_REPO_LOCATION_CLIENT: code/tests/pki/client.p12
# run: |
# pip install dist/ibmmq-*-linux_x86_64.whl
# python code/tests/test_tls.py

# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true

- name: Publish to PyPI - on tag
# Skip upload to PyPI if we don't have a tag
if: startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@release/v1
Loading