Skip to content

Commit

Permalink
Merge pull request #309 from pact-foundation/arm64_ruby
Browse files Browse the repository at this point in the history
Feat: ARM64 Support for OSX / Linux + Windows 32 bit support
  • Loading branch information
YOU54F committed Jul 14, 2023
2 parents 43d2e2c + 4705ded commit 8c56e16
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 5 deletions.
43 changes: 43 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
BUILD_TEST_TASK_TEMPLATE: &BUILD_TEST_TASK_TEMPLATE
arch_check_script:
- uname -am
test_script:
- composer install
- composer run lint
- composer run static-code-analysis
- composer test

linux_arm64_task:
env:
COMPOSER_ALLOW_SUPERUSER: 1
matrix:
- IMAGE: php:8.2
- IMAGE: php:8.1
- IMAGE: php:8.0
container:
image: $IMAGE
pre_req_script:
- apt update --yes && apt install --yes zip unzip git libyaml-dev
- curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
- php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
- docker-php-ext-install sockets
version_check_script:
- php --version
<< : *BUILD_TEST_TASK_TEMPLATE

macos_arm64_task:
# https://www.markhesketh.com/switching-multiple-php-versions-on-macos/
env:
matrix:
- VERSION: 8.2
- VERSION: 8.1
- VERSION: 8.0
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-base:latest
pre_req_script:
- brew install php@$VERSION composer
version_check_script:
- php --version
<< : *BUILD_TEST_TASK_TEMPLATE


2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: pact-php

on:
push:
push:
pull_request:
# Once on the first of the month at 06:00 UTC
schedule:
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ Table of contents
- [Usage for the optional `pact-stub-service`](#usage-for-the-optional-pact-stub-service)

## Versions
9.X updates internal dependencies and libraries. This results in dropping PHP 7.4

9.X updates internal dependencies and libraries including pact-ruby-standalone v2.x which adds support for ARM64 CPU's for Linux/MacOS and providing x86 and x86_64 Windows via pact-ruby-standalone v2.x. This results in dropping PHP 7.4

8.X updates internal dependencies and libraries. This results in dropping PHP 7.3

Expand All @@ -61,6 +62,17 @@ If you wish to stick with the 2.X implementation, you can continue to pull from

The 3.X version is the version of Pact-PHP, not the pact specification version that it supports. Pact-Php 3.X supports [Pact-Specification 2.X](https://github.com/pact-foundation/pact-specification/tree/version-2).

##  Supported Platforms

| OS | Architecture | Supported | Pact-PHP Version |
| ------- | ------------ | --------- | ---------------- |
| OSX | x86_64 || All |
| Linux | x86_64 || All |
| OSX | arm64 || 9.x + |
| Linux | arm64 || 9.x + |
| Windows | x86_64 || All |
| Windows | x86 || All |

## Installation

Install the latest version with:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@
"extra": {
"downloads": {
"pact-ruby-standalone": {
"version": "1.91.0",
"version": "2.0.3",
"variables": {
"{$os}": "PHP_OS_FAMILY === 'Windows' ? 'win32' : (PHP_OS === 'Darwin' ? 'osx' : 'linux')",
"{$architecture}": "PHP_OS === 'Linux' ? '-x86_64' : ''",
"{$os}": "PHP_OS_FAMILY === 'Windows' ? 'windows' : (PHP_OS === 'Darwin' ? 'osx' : 'linux')",
"{$architecture}": "strtolower(php_uname('m')) === 'arm64' || strtolower(php_uname('m')) === 'aarch64' ? '-arm64' : (strtolower(php_uname('m')) === 'x86' && PHP_OS_FAMILY === 'Windows' ? '-x86' : '-x86_64')",
"{$extension}": "PHP_OS_FAMILY === 'Windows' ? 'zip' : 'tar.gz'"
},
"url": "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v{$version}/pact-{$version}-{$os}{$architecture}.{$extension}",
Expand Down
7 changes: 7 additions & 0 deletions tests/PhpPact/Standalone/Broker/BrokerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,17 @@ public function getArgumentsEmptyConfig(): void
// $this->assertContains('-', (new Broker(new BrokerConfig()))->generateUuid());
//}


/**
* @test
*
* @throws \Exception
*/
public function describeVersion(): void
{

// this test has slain many a developer 🤯
// if (php_uname('m') != 'arm64' && PHP_OS != 'Linux') {
$config = new BrokerConfig();
$config->setPacticipant('Animal Profile Service')
->setBrokerUri(new Uri('https://test.pactflow.io'))
Expand All @@ -59,8 +63,11 @@ public function describeVersion(): void
$result = $broker->describeVersion();

$this->assertArrayHasKey('number', $result);
// };
}



/**
* @test
*
Expand Down

0 comments on commit 8c56e16

Please sign in to comment.