2021-03-11 01:41:05 +01:00
|
|
|
name: Build and Lint
|
|
|
|
on:
|
2021-04-24 03:29:53 +02:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
pull_request:
|
2021-03-11 01:41:05 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2021-08-21 15:33:22 +02:00
|
|
|
name: Build and Test
|
2022-02-21 23:24:39 +01:00
|
|
|
runs-on: ${{ matrix.os }}
|
2021-03-11 01:41:05 +01:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-03-18 04:36:51 +01:00
|
|
|
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
|
2021-03-11 01:41:05 +01:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php }}
|
2022-03-18 04:36:51 +01:00
|
|
|
env:
|
|
|
|
phpts: ${{ matrix.phpts }}
|
2021-03-11 01:41:05 +01:00
|
|
|
- name: Setup Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
2022-03-18 04:36:51 +01:00
|
|
|
toolchain: ${{ matrix.rust }}
|
2021-09-05 07:56:29 +02:00
|
|
|
override: true
|
2022-03-06 04:01:27 +01:00
|
|
|
components: rustfmt, clippy
|
2021-04-16 14:17:02 +02:00
|
|
|
- name: Setup LLVM & Clang
|
2022-03-18 04:36:51 +01:00
|
|
|
if: "!contains(matrix.os, 'windows')"
|
2022-03-06 04:01:27 +01:00
|
|
|
id: clang
|
2021-04-16 14:17:02 +02:00
|
|
|
uses: KyleMayes/install-llvm-action@v1
|
|
|
|
with:
|
2022-03-18 04:36:51 +01:00
|
|
|
version: '13.0'
|
|
|
|
directory: ${{ runner.temp }}/llvm
|
2022-03-06 04:01:27 +01:00
|
|
|
- name: Configure Clang
|
2022-03-18 04:36:51 +01:00
|
|
|
if: "!contains(matrix.os, 'windows')"
|
2022-03-06 04:01:27 +01:00
|
|
|
run: |
|
2022-03-18 04:36:51 +01:00
|
|
|
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm/lib" >> $GITHUB_ENV
|
2022-03-06 04:01:27 +01:00
|
|
|
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
|
2021-03-11 01:41:05 +01:00
|
|
|
- name: Build
|
2021-04-16 14:05:17 +02:00
|
|
|
env:
|
2021-09-05 07:56:29 +02:00
|
|
|
EXT_PHP_RS_TEST:
|
2021-11-20 02:19:02 +01:00
|
|
|
run: cargo build --release --all-features --all
|
2021-08-21 15:33:22 +02:00
|
|
|
- name: Test inline examples
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
2022-03-18 04:36:51 +01:00
|
|
|
args: --release --all --all-features
|
2021-03-11 01:41:05 +01:00
|
|
|
- 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
|
2021-11-20 02:19:02 +01:00
|
|
|
args: --all -- -D warnings
|
2022-09-28 19:26:03 +02:00
|
|
|
if: matrix.rust == 'stable'
|
2021-10-10 11:57:38 +02:00
|
|
|
- name: Build with docs stub
|
2022-03-18 04:36:51 +01:00
|
|
|
if: "contains(matrix.os, 'ubuntu') && matrix.php == '8.1'"
|
2021-10-10 11:57:38 +02:00
|
|
|
env:
|
|
|
|
DOCS_RS:
|
|
|
|
run:
|
|
|
|
cargo clean && cargo build
|
2022-03-06 04:01:27 +01:00
|
|
|
build-zts:
|
|
|
|
name: Build with ZTS
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build
|
|
|
|
uses: ./.github/actions/zts
|