Skip to content

Commit

Permalink
feat: Add OO interface for config, engine, store, wat, valtype and gl…
Browse files Browse the repository at this point in the history
…obaltype
  • Loading branch information
jubianchi committed Feb 18, 2021
1 parent 782325b commit 4dadeca
Show file tree
Hide file tree
Showing 24 changed files with 886 additions and 105 deletions.
6 changes: 6 additions & 0 deletions .atoum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

$php = getenv('PHP_EXECUTABLE') ?: 'php';

$runner->setPhpPath($php.' -dextension='.__DIR__.'/ext/modules/wasm.so');
$runner->addTestsFromDirectory('tests');
5 changes: 5 additions & 0 deletions .github/workflows/doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:
php-version: 7.4
- name: Checkout code
uses: actions/checkout@v2
- name: Configure
run: |
cd ext
phpize
./configure
- name: Build
run: |
make documentation
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ jobs:
run: |
cd ext
make examples || ${{ matrix.allow_failure }}
- name: Run tests (unit)
# TODO(jubianchi): Remove allow_failure once PHP 7.3 & 7.4 are supported
run: |
make unit || ${{ matrix.allow_failure }}
- name: Archive test results
if: ${{ failure() }}
uses: actions/upload-artifact@v2
Expand Down
2 changes: 2 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
$finder = PhpCsFixer\Finder::create()
->notName('wasmer_vec.stub.php')
->in('ext/src')
->in('src')
;

$config = new PhpCsFixer\Config();

return $config->setRules([
'@PSR2' => true,
'@Symfony' => true,
'strict_param' => true,
'phpdoc_align' => true,
])
Expand Down
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
include ext/Makefile

documentation: .phpdoc/build/index.html

.PHONY: unit
unit: vendor/atoum/atoum/bin/atoum
PHP_EXECUTABLE=$(PHP_EXECUTABLE) $<

.PHONY: lint
lint: vendor/friendsofphp/php-cs-fixer/php-cs-fixer
$< fix --dry-run --allow-risky=yes
$(PHP_EXECUTABLE) $< fix --dry-run --allow-risky=yes

.phpdoc/build/index.html: vendor/phpdocumentor/phpdocumentor/bin/phpdoc ext/src/wasmer_*.stub.php
$<
.phpdoc/build/index.html: vendor/phpdocumentor/phpdocumentor/bin/phpdoc ext/src/wasmer_*.stub.php src/*.php
$(PHP_EXECUTABLE) $<

vendor/phpdocumentor/phpdocumentor/bin/phpdoc vendor/friendsofphp/php-cs-fixer/php-cs-fixer: composer.lock
vendor/phpdocumentor/phpdocumentor/bin/phpdoc vendor/friendsofphp/php-cs-fixer/php-cs-fixer vendor/atoum/atoum/bin/atoum: composer.lock
composer install

composer.lock: composer.json
Expand Down
14 changes: 12 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
"name": "wasm/wasm",
"description": "A complete and mature WebAssembly runtime for PHP based on Wasmer",
"type": "library",
"require": {
"ext-wasm": "*"
},
"require-dev": {
"phpdocumentor/phpdocumentor": "@dev",
"friendsofphp/php-cs-fixer": "9999999-dev"
"friendsofphp/php-cs-fixer": "@dev",
"atoum/atoum": "@stable"
},
"minimum-stability": "dev",
"license": "MIT",
Expand All @@ -16,7 +20,13 @@
],
"config": {
"platform": {
"php": "7.3"
"php": "7.3",
"ext-wasm": "1.0.0-beta1"
}
},
"autoload": {
"psr-4": {
"Wasm\\": "src"
}
}
}
Loading

0 comments on commit 4dadeca

Please sign in to comment.