ext-php-rs/.github/workflows/build.yml
David 4a4370c817
Add ability to send Rust closures to PHP (#58)
* Start work on returning new objects

Change `IntoZval` to consume `self`

* Add conversion from vector reference to PHP hashtable through clones

* `set_binary` now only takes `Vec`

Used to take `AsRef<[T]>` to allow users to pass arrays, however, this
causes the data to be cloned even if the user passes a `Vec`.

* Rename `as_zval` to `into_zval` to match Rust conventions

* Started work on closures

* Finish implementation of closures

* Document closures, add to prelude, feature gate

* Fixed closure example
2021-09-05 13:45:59 +12:00

105 lines
2.7 KiB
YAML

name: Build and Lint
on:
push:
branches:
- master
pull_request:
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
rust-toolchain:
- stable
- nightly
php:
- '8.0'
llvm:
- '11.0'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust-toolchain }}
- name: Setup LLVM & Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: ${{ matrix.llvm }}
directory: ${{ runner.temp }}/llvm-${{ matrix.llvm }}
- name: Install mdbook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: latest
- name: Build
uses: actions-rs/cargo@v1
env:
LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib
with:
command: build
args: --release --features alloc,closure
- name: Test guide examples
run: |
mdbook test guide -L target/release/deps
- name: Test inline examples
uses: actions-rs/cargo@v1
env:
LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib
with:
command: test
args: --release
build-zts:
name: Build with ZTS
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build
uses: ./.github/actions/zts
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
llvm:
- '11.0'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Setup LLVM & Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: ${{ matrix.llvm }}
directory: ${{ runner.temp }}/llvm-${{ matrix.llvm }}
- name: Run rustfmt
uses: actions-rs/cargo@v1
env:
LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib
with:
command: fmt
args: --all -- --check
- name: Run clippy
uses: actions-rs/cargo@v1
env:
LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib
with:
command: clippy
args: -- -D warnings