mirror of
https://github.com/danog/ext-php-rs.git
synced 2024-11-27 04:24:54 +01:00
90 lines
2.5 KiB
YAML
90 lines
2.5 KiB
YAML
name: Build and Lint
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
name: Build and Test
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
php: ['8.0', '8.1']
|
|
rust: [stable, nightly]
|
|
phpts: [ts, nts]
|
|
exclude:
|
|
# ext-php-rs requires nightly Rust when on Windows.
|
|
- os: windows-latest
|
|
rust: stable
|
|
# setup-php doesn't support thread safe PHP on Linux and macOS.
|
|
- os: macos-latest
|
|
phpts: ts
|
|
- os: ubuntu-latest
|
|
phpts: ts
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
env:
|
|
phpts: ${{ matrix.phpts }}
|
|
- name: Setup Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- name: Setup LLVM & Clang
|
|
if: "!contains(matrix.os, 'windows')"
|
|
id: clang
|
|
uses: KyleMayes/install-llvm-action@v1
|
|
with:
|
|
version: '13.0'
|
|
directory: ${{ runner.temp }}/llvm
|
|
- name: Configure Clang
|
|
if: "!contains(matrix.os, 'windows')"
|
|
run: |
|
|
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm/lib" >> $GITHUB_ENV
|
|
echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
|
|
- name: Configure Clang (macOS only)
|
|
if: "contains(matrix.os, 'macos')"
|
|
run: echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
|
|
- name: Build
|
|
env:
|
|
EXT_PHP_RS_TEST:
|
|
run: cargo build --release --all-features --all
|
|
- name: Test inline examples
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: --release --all --all-features
|
|
- name: Run rustfmt
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fmt
|
|
args: --all -- --check
|
|
- name: Run clippy
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
args: --all -- -D warnings
|
|
- name: Build with docs stub
|
|
if: "contains(matrix.os, 'ubuntu') && matrix.php == '8.1'"
|
|
env:
|
|
DOCS_RS:
|
|
run:
|
|
cargo clean && cargo build
|
|
build-zts:
|
|
name: Build with ZTS
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
- name: Build
|
|
uses: ./.github/actions/zts
|