You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jd...@apache.org on 2023/04/09 19:45:14 UTC
[qpid-python] branch main updated: QPID-8170: add basic GitHub Actions CI jobs (#3)
This is an automated email from the ASF dual-hosted git repository.
jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-python.git
The following commit(s) were added to refs/heads/main by this push:
new 04c3fa8 QPID-8170: add basic GitHub Actions CI jobs (#3)
04c3fa8 is described below
commit 04c3fa84ccb6681759d68ee9d95dfd70cebe7443
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Sun Apr 9 21:45:09 2023 +0200
QPID-8170: add basic GitHub Actions CI jobs (#3)
---
.github/workflows/python-package.yml | 113 +++++++++++++++++++++++++++++++++++
.github/workflows/python-publish.yml | 61 +++++++++++++++++++
pyproject.toml | 28 +++++++++
3 files changed, 202 insertions(+)
diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml
new file mode 100644
index 0000000..557641c
--- /dev/null
+++ b/.github/workflows/python-package.yml
@@ -0,0 +1,113 @@
+#
+# 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.
+#
+
+# https://github.com/actions/starter-workflows/blob/main/ci/python-package.yml
+
+# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
+# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
+
+name: Python package
+
+on:
+ push:
+ pull_request:
+ workflow_dispatch:
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ # https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
+ python-version: ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12.0-alpha.7"]
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v3
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install --user poetry
+
+ - name: Cache Poetry virtualenv
+ uses: actions/cache@v3
+ id: cache-home-virtualenvs
+ with:
+ path: ~/.virtualenvs
+ key: poetry-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
+ restore-keys: |
+ poetry-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
+
+ - name: Set Poetry config
+ run: |
+ echo "POETRY_VIRTUALENVS_PATH=${HOME}/.virtualenvs" >> ${GITHUB_ENV}
+ echo "POETRY_VIRTUALENVS_IN-PROJECT=false" >> ${GITHUB_ENV}
+
+ - name: Set additional Poetry config (py2.7)
+ if: matrix.python-version == '2.7'
+ run: |
+ # https://github.com/python-poetry/poetry/issues/3010
+ # workaround parallel installation bug in old poetry
+ echo "POETRY_INSTALLER_MAX-WORKERS=1" >> ${GITHUB_ENV}
+
+ - name: Install Dependencies
+ run: |
+ poetry env use ${{ env.pythonLocation }}/bin/python
+ poetry install --no-root
+ if: steps.cache.outputs.cache-hit != 'true'
+
+ - name: Lint with flake8
+ continue-on-error: true
+ run: |
+ # stop the build if there are Python syntax errors or undefined names
+ poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
+ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
+ poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
+
+ - name: Lint with ruff
+ continue-on-error: true
+ run: |
+ poetry run ruff check .
+
+ - name: Test with our bespoke test runner
+ run: |
+ docker run --rm -d -p 5672:5672 irinabov/docker-qpid-cpp-broker
+
+ attempts=0
+ while ! nc -zv localhost 5672; do
+ attempts=$((attempts+1))
+ if [ $attempts -ge 10 ]; then
+ echo >&2 "qpidd not reachable, giving up"
+ exit 1
+ fi
+ sleep 3
+ done
+
+ ${{ env.pythonLocation }}/bin/python ./qpid-python-test
+
+ - name: Test setup.py install
+ run: |
+ ${{ env.pythonLocation }}/bin/python setup.py install --user
diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml
new file mode 100644
index 0000000..5d459d1
--- /dev/null
+++ b/.github/workflows/python-publish.yml
@@ -0,0 +1,61 @@
+#
+# 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.
+#
+
+# https://github.com/actions/starter-workflows/blob/main/ci/python-publish.yml
+
+# This workflow will upload a Python Package using Twine when a release is created
+# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
+
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+
+name: Upload Python Package
+
+on:
+ release:
+ types: [published]
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+jobs:
+ deploy:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Python
+ uses: actions/setup-python@v3
+ with:
+ python-version: '3.x'
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install build
+ - name: Build package
+ run: python -m build
+ - name: Publish package
+ uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
+ with:
+ user: __token__
+ password: ${{ secrets.PYPI_API_TOKEN }}
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..996ecde
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,28 @@
+[tool.poetry]
+name = "qpid-python"
+version = "0.0.0"
+description = ""
+authors = ["Apache Qpid <us...@qpid.apache.org>"]
+license = "Apache Software License"
+readme = "README.md"
+packages = [{include = "qpid_python"}]
+
+[tool.poetry.dependencies]
+
+# https://github.com/python-poetry/poetry/issues/4983
+# dependency groups don't work on the latest poetry available for python 2.7
+# [tool.poetry.group.dev.dependencies]
+
+[tool.poetry.dev-dependencies]
+# need this to resolve flake8 on python2.7
+importlib-metadata = {version = "^2.1.3", python = "^2.7"}
+flake8 = [
+ {version = "^3.9.2", python = "^2.7" },
+ {version = "^6.0.0", python = ">=3.8.1" },
+]
+pytest = { version = "^7.3.0", python = ">=3.7" }
+ruff = { version = "^0.0.261", python = ">=3.7" }
+
+[build-system]
+requires = ["poetry-core"]
+build-backend = "poetry.core.masonry.api"
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org