Skip to content

Commit

Permalink
Merge pull request #323 from YOU54F/ffi
Browse files Browse the repository at this point in the history
pact_ffi library targeting ffi branch for beta use by users
  • Loading branch information
YOU54F committed Jul 24, 2023
2 parents d13e336 + bcdc7cc commit 91d9006
Show file tree
Hide file tree
Showing 172 changed files with 5,245 additions and 5,015 deletions.
52 changes: 52 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
BUILD_TEST_TASK_TEMPLATE: &BUILD_TEST_TASK_TEMPLATE
arch_check_script:
- uname -am
install_script:
- composer install
cirrus_ci_macos_local_script: |
if [ "$(uname -s)" == 'Darwin' ] && [ "$CIRRUS_CLI" == 'true' ]; then
chmod +x vendor/bin/php-cs-fixer
chmod +x vendor/bin/phpstan
chmod +x vendor/bin/phpunit
chmod +x bin/pact-stub-server/pact-stub-server
fi
lint_script:
- composer run lint
static_analysis_script:
- composer run static-code-analysis
test_script:
- composer test

linux_arm64_task:
env:
COMPOSER_ALLOW_SUPERUSER: 1
matrix:
- VERSION: 8.2
- VERSION: 8.1
- VERSION: 8.0
container:
image: php:$VERSION
pre_req_script:
- apt update --yes && apt install --yes zip unzip git libffi-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
- docker-php-ext-install ffi
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
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Dependabot Config

version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

# Maintain dependencies for Composer
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
7 changes: 5 additions & 2 deletions .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 All @@ -27,6 +27,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- uses: ramsey/composer-install@v2
with:
Expand All @@ -48,6 +49,7 @@ jobs:
operating-system: [ ubuntu-latest, macos-latest, windows-latest ]
php: [ '8.0', '8.1', '8.2' ]
dependencies: [ 'lowest', 'locked' ]
timeout-minutes: 5

name: PHP ${{ matrix.php }} on ${{ matrix.operating-system }} with ${{ matrix.dependencies }} dependencies

Expand All @@ -58,8 +60,9 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
extensions: openssl, sockets, curl, zip
extensions: sockets, curl, zip, ffi
php-version: ${{ matrix.php }}
coverage: none

- name: Composer install
uses: ramsey/composer-install@v2
Expand Down
3 changes: 2 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
->name('*.php');

$config = new PhpCsFixer\Config();
$config->setRules(['@PSR12' => true,
$config->setRules([
'@PSR12' => true,
'strict_param' => false,
'array_syntax' => ['syntax' => 'short'],
])
Expand Down
57 changes: 57 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Pact-PHP

## Pre Reqs

- PHP 8.x or greater
- FFI and Sockets extensions enabled in your php.ini

## Steps

1. Run `composer install`
1. This will install php dependencies to `vendor`
2. This will install pact libraries to `bin`
2. Run `composer test`
1. This will run our unit tests
3. Run `composer lint`
1. This will run the phpcs-lint
4. Run `composer fix`
1. This will correct any auto fixable linter errors
5. Run `composer static-code-analysis`
1. Run static code analysis

## CI Locally

### MacOS ARM

#### Pre Reqs

- MacOS ARM
- Tart.run
- Cirrus-CLI

#### Steps

Run all versions of PHP

- `cirrus run --output github-actions macos_arm64 -e CIRRUS_CLI=true`

Run a specified version of PHP

- `cirrus run --output github-actions 'macos_arm64 VERSION:8.2' -e CIRRUS_CLI=true`

### Linux ARM

#### Pre Reqs

- Docker
- x86_64 or arm64/aarch64 host

#### Steps

Run all versions of PHP

- `cirrus run --output github-actions linux_arm64`

Run a specified version of PHP

- `cirrus run --output github-actions 'macos_arm64 VERSION:8.2'`
Loading

0 comments on commit 91d9006

Please sign in to comment.