diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 000000000..27098bdaa --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,55 @@ +BUILD_TEST_TASK_TEMPLATE: &BUILD_TEST_TASK_TEMPLATE + arch_check_script: + - uname -am + test_script: + - python --version + - python -m pip install --upgrade pip + - python -m pip install -r requirements_dev.txt + - python -m flake8 + - python -m pydocstyle pact + - python -m tox -e test + # - make examples + +linux_arm64_task: + env: + matrix: + # - IMAGE: python:3.6-slim # This works locally, with cirrus run, but fails in CI + - IMAGE: python:3.7-slim + - IMAGE: python:3.8-slim + - IMAGE: python:3.9-slim + - IMAGE: python:3.10-slim + arm_container: + image: $IMAGE + install_script: + - apt update --yes && apt install --yes gcc make + << : *BUILD_TEST_TASK_TEMPLATE + + +macosx_arm64_task: + macos_instance: + image: ghcr.io/cirruslabs/macos-ventura-base:latest + env: + PATH: ${HOME}/.pyenv/shims:${PATH} + matrix: + - PYTHON: 3.6 + - PYTHON: 3.7 + - PYTHON: 3.8 + - PYTHON: 3.9 + - PYTHON: 3.10 + install_script: + # Per the pyenv homebrew recommendations. + # https://github.com/pyenv/pyenv/wiki#suggested-build-environment + # - xcode-select --install # Unnecessary on Cirrus + - brew update + # - brew install openssl readline sqlite3 xz zlib + - brew install pyenv + - pyenv install ${PYTHON} + - pyenv global ${PYTHON} + - pyenv rehash + ## To install rosetta + # - softwareupdate --install-rosetta --agree-to-license + << : *BUILD_TEST_TASK_TEMPLATE + + + + diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 6624e484f..26e8651ed 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -19,7 +19,7 @@ jobs: - '3.9' - '3.10' - '3.11' - os: [ ubuntu-latest ] + os: [ ubuntu-latest, windows-latest, macos-latest ] # These versions are no longer supported by Python team, and may # eventually be dropped from GitHub Actions. @@ -29,7 +29,7 @@ jobs: steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 @@ -50,4 +50,5 @@ jobs: run: tox -e test - name: Test examples + if: runner.os == 'Linux' run: make examples diff --git a/.github/workflows/package_and_push_to_pypi.yml b/.github/workflows/package_and_push_to_pypi.yml index 485fdc16a..4336ce061 100644 --- a/.github/workflows/package_and_push_to_pypi.yml +++ b/.github/workflows/package_and_push_to_pypi.yml @@ -9,9 +9,9 @@ jobs: environment: "Upload Python Package" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install dependencies diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..a048a2b3a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +ARG PYTHON_VERSION=3.6 +FROM python:$PYTHON_VERSION-slim + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt update --yes && apt install --yes gcc make + +WORKDIR /app +COPY . /app + +RUN python -m pip install --upgrade pip +RUN python -m pip install -r requirements_dev.txt +RUN python -m flake8 +RUN python -m pydocstyle pact +RUN python -m tox -e test + +CMD ["sh","-c","python -m tox -e test"] \ No newline at end of file diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu new file mode 100644 index 000000000..aaf6224b9 --- /dev/null +++ b/Dockerfile.ubuntu @@ -0,0 +1,30 @@ +FROM ubuntu:22.04 +ENV DEBIAN_FRONTEND=noninteractive +ARG PYTHON_VERSION 3.9 + +#Set of all dependencies needed for pyenv to work on Ubuntu +RUN apt-get update \ + && apt-get install -y --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget ca-certificates curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev mecab-ipadic-utf8 git + +# Set-up necessary Env vars for PyEnv +ENV PYENV_ROOT /root/.pyenv +ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH + +# Install pyenv +RUN set -ex \ + && curl https://pyenv.run | bash \ + && pyenv update \ + && pyenv install $PYTHON_VERSION \ + && pyenv global $PYTHON_VERSION \ + && pyenv rehash + +WORKDIR /app +COPY . /app + +RUN python -m pip install --upgrade pip +RUN python -m pip install -r requirements_dev.txt +RUN python -m flake8 +RUN python -m pydocstyle pact +RUN python -m tox -e test + +CMD ["sh","-c","python -m tox -e test"] \ No newline at end of file diff --git a/MANIFEST b/MANIFEST index 610dd70df..5793cf027 100644 --- a/MANIFEST +++ b/MANIFEST @@ -21,9 +21,10 @@ pact/pact.py pact/provider.py pact/verifier.py pact/verify_wrapper.py -pact/bin/pact-1.88.83-linux-x86.tar.gz -pact/bin/pact-1.88.83-linux-x86_64.tar.gz -pact/bin/pact-1.88.83-osx.tar.gz -pact/bin/pact-1.88.83-win32.zip +pact/bin/pact-3.1.2.2-alpha-linux-arm64.tar.gz +pact/bin/pact-3.1.2.2-alpha-linux-x86_64.tar.gz +pact/bin/pact-3.1.2.2-alpha-osx-arm64.tar.gz +pact/bin/pact-3.1.2.2-alpha-osx-x86_64.tar.gz +pact/bin/pact-3.1.2.2-alpha-windows-x86_64.zip pact/cli/__init__.py pact/cli/verify.py diff --git a/run-docker.sh b/run-docker.sh new file mode 100755 index 000000000..ef98a520b --- /dev/null +++ b/run-docker.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +for arch in arm64 amd64; do + # for version in 3.6; do + for version in 3.7 3.8 3.9 3.10 3.11; do + docker build -t python-$arch-$version --build-arg PYTHON_VERSION=$version --platform=linux/$arch . + docker run -it --rm python-$arch-$version + done +done \ No newline at end of file diff --git a/setup.py b/setup.py index 98d67657d..4d502eb6d 100644 --- a/setup.py +++ b/setup.py @@ -15,11 +15,14 @@ IS_64 = sys.maxsize > 2 ** 32 -PACT_STANDALONE_VERSION = '1.88.83' -PACT_STANDALONE_SUFFIXES = ['osx.tar.gz', +PACT_STANDALONE_VERSION = '2.0.0' +PACT_STANDALONE_SUFFIXES = ['osx-x86_64.tar.gz', + 'osx-arm64.tar.gz', 'linux-x86_64.tar.gz', - 'linux-x86.tar.gz', - 'win32.zip'] + 'linux-arm64.tar.gz', + 'windows-x86_64.zip', + 'windows-x86.zip', + ] here = os.path.abspath(os.path.dirname(__file__)) @@ -131,15 +134,18 @@ def ruby_app_binary(): target_platform = platform.platform().lower() binary = ('pact-{version}-{suffix}') - - if 'darwin' in target_platform or 'macos' in target_platform: - suffix = 'osx.tar.gz' - elif 'linux' in target_platform and IS_64: - suffix = 'linux-x86_64.tar.gz' + if ("darwin" in target_platform or "macos" in target_platform) and ("aarch64" in platform.machine() or "arm64" in platform.machine()): + suffix = 'osx-arm64.tar.gz' + elif ("darwin" in target_platform or "macos" in target_platform) and IS_64: + suffix = 'osx-x86_64.tar.gz' + elif 'linux' in target_platform and IS_64 and "aarch64" in platform.machine(): + suffix = 'linux-arm64.tar.gz' elif 'linux' in target_platform: - suffix = 'linux-x86.tar.gz' + suffix = 'linux-x86_64.tar.gz' + elif 'windows' in target_platform and IS_64: + suffix = 'windows-x86_64.zip' elif 'windows' in target_platform: - suffix = 'win32.zip' + suffix = 'windows-x86.zip' else: msg = ('Unfortunately, {} is not a supported platform. Only Linux,' ' Windows, and OSX are currently supported.').format(