Skip to content

Commit

Permalink
devops: Move PHP build to Taskfile (#3164)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
max-sixty and pre-commit-ci[bot] committed Jul 29, 2023
1 parent 0baf6e5 commit 1285a4e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/test-php.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,8 @@ jobs:
steps:
- name: 📂 Checkout code
uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: arduino/setup-task@v1
with:
toolchain: stable
- run: sh build.sh
working-directory: bindings/prql-php
- name: 📦 Install dependencies using Composer
uses: php-actions/composer@v6
with:
args: --working-dir=bindings/prql-php
php_extensions: FFI
- name: 🧪 Run tests using PHPUnit
run: vendor/bin/phpunit tests
working-directory: bindings/prql-php
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- run: task build-php
- run: task test-php
12 changes: 12 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,18 @@ tasks:
- package.json
generates:
- node_modules/*

build-php:
- cargo build -p prql-lib --release
- mkdir -p bindings/prql-php/lib/
- cp target/release/libprql_lib.* bindings/prql-lib/libprql_lib.h
bindings/prql-php/lib/
- cd bindings/prql-php && composer install

test-php:
dir: bindings/prql-php
cmds:
- vendor/bin/phpunit tests
# The next three tasks are not used for either:
# - the Dockerfile (installing brew takes forever)
# so the Dockerfile simply installs hugo & nodejs directly
Expand Down
8 changes: 4 additions & 4 deletions bindings/prql-php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ This will pull-in ext-ffi extension, because it's declared in `composer.json`.

### Building

There is a `build.sh` script that:
There is a `task build-php` script that:

- runs cargo to build `libprql_lib`,
- copies `libprql_lib.so` into `lib`,
- copies `libprql_lib.*` into `lib`,
- copies `libprql_lib.h` into `lib`.

### Tests

```
sh build.sh
./vendor/bin/phpunit tests
task build-php
task test-php
```

### Code style
Expand Down
8 changes: 0 additions & 8 deletions bindings/prql-php/build.sh

This file was deleted.

0 comments on commit 1285a4e

Please sign in to comment.