ext-php-rs/.github/workflows/build.yml
David Cole 6df362b714
Added CLI crate for stubs, installation and removal (#107)
* started work on stub generator

* Worked on stub CLI tool

* Unused import

* Account for namespaces in function and class names

* Add support for docblocks on structs

* Push Rust comments to stubs

* Add indentation to stub generation

* Add CLI application to install and generate stubs

This time CLI application is defined on user side, called with `cargo
run -- ..args..`

* Export anyhow result

* Add constants to stub file

* Removed stub symbols

No longer required as we are now building while also linking to PHP.
Keeping the stubs causes the stubs to override the real symbols in the
extension.

* Fix stubs for real this time

Removed stub symbols as they were being included in the extension
dylib, fix by loading the PHP executable as a dylib, loading the
required symbols globally.

* Maybe actually fix stubs this time

* Forgot to remove PHP binary loading

* let's give this another go... cargo subcommand

Now called via `cargo php <install,stubs>`.

* Added `remove` command

* Tidied up cargo-php, commented, set up CI

* Fix return types with non-ident types

* define namespace ordering

* Fix tests, replace `Self` when in outer context

* Moved allowed bindings into separate file

* Update guide with CLI instructions
2021-11-20 14:19:02 +13:00

112 lines
2.9 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 }}
override: true
- 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
env:
LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib
EXT_PHP_RS_TEST:
run: cargo build --release --all-features --all
- name: Test guide examples
env:
CARGO_PKG_NAME: mdbook-tests
CARGO_PKG_VERSION: 0.1.0
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 --all
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: --all -- -D warnings
- name: Build with docs stub
env:
DOCS_RS:
run:
cargo clean && cargo build