ext-php-rs/.github/workflows/build.yml
Dirk Stolle ca5a7c21f7 ci: run clippy only on stable Rust channel
Sparked by the comments about nightly clippy breaking the build
too often (see <https://github.com/davidcole1340/ext-php-rs/pull/151#issuecomment-1261151479>),
this change will limit clippy to builds with a stable Rust
version only.
2022-09-28 22:08:10 +02:00

91 lines
2.6 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@v2
- 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
if: matrix.rust == 'stable'
- 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@v2
- name: Build
uses: ./.github/actions/zts