mirror of
https://github.com/danog/ext-php-rs.git
synced 2024-12-14 18:15:26 +01:00
11e0998bc4
## Small Fixes due to PHP8.2 upgrade: - Internal PHP `ZendHashmap` changed the way that we access to the bucket ([commit](90b7bde615 (diff-dca4782c62f10b418ea7193e4641e688ffd7a9c97869f2b1a3a96e28da5653aaL371)
)) - Internal PHP `ArrayIterator` doesn't support parent `get_iterator` ([commit](15bbf6f337 (diff-bc002b59b592b4d44c13d898f9dc3ca60b1b1c8505a51a2a3557dfde51dfeb61L273)
))
113 lines
3.7 KiB
YAML
113 lines
3.7 KiB
YAML
name: Build and Lint
|
|
on:
|
|
schedule:
|
|
# runs every monday at midnight
|
|
- cron: "0 0 * * 1"
|
|
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", "8.2"]
|
|
rust: [stable, nightly]
|
|
clang: ["14"]
|
|
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
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
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 }}
|
|
debug: true
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
components: rustfmt, clippy
|
|
- run: rustup show
|
|
- name: Cache cargo dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
# Uncomment the following if statement if caching nightly deps
|
|
# ends up causing too much cache invalidation.
|
|
# if: matrix.rust == 'stable'
|
|
with:
|
|
# increment this manually to force cache eviction
|
|
prefix-key: "v0-rust"
|
|
# LLVM & Clang
|
|
- name: Cache LLVM and Clang
|
|
id: cache-llvm
|
|
uses: actions/cache@v3
|
|
if: "!contains(matrix.os, 'windows')"
|
|
with:
|
|
path: ${{ runner.temp }}/llvm-${{ matrix.clang }}
|
|
key: ${{ matrix.os }}-llvm-${{ matrix.clang }}
|
|
- name: Setup LLVM & Clang
|
|
id: clang
|
|
uses: KyleMayes/install-llvm-action@v1
|
|
if: "!contains(matrix.os, 'windows')"
|
|
with:
|
|
version: ${{ matrix.clang }}
|
|
directory: ${{ runner.temp }}/llvm-${{ matrix.clang }}
|
|
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
|
|
- name: Configure Clang
|
|
if: "!contains(matrix.os, 'windows')"
|
|
run: |
|
|
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/lib" >> $GITHUB_ENV
|
|
echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
|
|
echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/bin/llvm-config" >> $GITHUB_ENV
|
|
- name: Configure Clang (macOS only)
|
|
if: "contains(matrix.os, 'macos')"
|
|
run: echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
|
|
# Build
|
|
- name: Build
|
|
env:
|
|
EXT_PHP_RS_TEST: ""
|
|
run: cargo build --release --all-features --all
|
|
# Test & lint
|
|
- name: Test inline examples
|
|
run: cargo test --release --all --all-features
|
|
- name: Run rustfmt
|
|
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
|
|
run: cargo fmt --all -- --check
|
|
- name: Run clippy
|
|
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
|
|
run: cargo clippy --all -- -D warnings
|
|
# Docs
|
|
- name: Run rustdoc
|
|
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
|
|
run: cargo rustdoc -- -D warnings
|
|
- name: Build with docs stub
|
|
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
|
|
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
|