Initial github workflow. #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | |
| 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 |