2021-03-11 01:41:05 +01:00
|
|
|
name: Build and Lint
|
|
|
|
on:
|
2022-11-24 09:05:36 +01:00
|
|
|
schedule:
|
|
|
|
# runs every monday at midnight
|
|
|
|
- cron: "0 0 * * 1"
|
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]
|
2022-11-24 09:05:36 +01:00
|
|
|
php: ["8.0", "8.1"]
|
2022-03-18 04:36:51 +01:00
|
|
|
rust: [stable, nightly]
|
2022-11-24 09:05:36 +01:00
|
|
|
clang: ["14"]
|
2022-03-18 04:36:51 +01:00
|
|
|
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
|
2022-11-24 09:05:36 +01:00
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
2021-03-11 01:41:05 +01:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2022-09-10 02:25:59 +02:00
|
|
|
uses: actions/checkout@v3
|
2021-03-11 01:41:05 +01:00
|
|
|
- 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
|
2022-11-24 09:05:36 +01:00
|
|
|
uses: dtolnay/rust-toolchain@master
|
2021-03-11 01:41:05 +01:00
|
|
|
with:
|
2022-03-18 04:36:51 +01:00
|
|
|
toolchain: ${{ matrix.rust }}
|
2022-03-06 04:01:27 +01:00
|
|
|
components: rustfmt, clippy
|
2022-11-24 09:05:36 +01:00
|
|
|
- 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
|
2022-03-18 04:36:51 +01:00
|
|
|
if: "!contains(matrix.os, 'windows')"
|
2022-11-24 09:05:36 +01:00
|
|
|
with:
|
|
|
|
path: ${{ runner.temp }}/llvm-${{ matrix.clang }}
|
|
|
|
key: ${{ matrix.os }}-llvm-${{ matrix.clang }}
|
|
|
|
- name: Setup LLVM & Clang
|
2022-03-06 04:01:27 +01:00
|
|
|
id: clang
|
2021-04-16 14:17:02 +02:00
|
|
|
uses: KyleMayes/install-llvm-action@v1
|
2022-11-24 09:05:36 +01:00
|
|
|
if: "!contains(matrix.os, 'windows')"
|
2021-04-16 14:17:02 +02:00
|
|
|
with:
|
2022-11-24 09:05:36 +01:00
|
|
|
version: ${{ matrix.clang }}
|
|
|
|
directory: ${{ runner.temp }}/llvm-${{ matrix.clang }}
|
|
|
|
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
|
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-11-24 09:05:36 +01:00
|
|
|
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/lib" >> $GITHUB_ENV
|
2022-03-06 04:01:27 +01:00
|
|
|
echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
|
2022-11-24 09:05:36 +01:00
|
|
|
echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/bin/llvm-config" >> $GITHUB_ENV
|
2022-03-06 04:01:27 +01:00
|
|
|
- name: Configure Clang (macOS only)
|
|
|
|
if: "contains(matrix.os, 'macos')"
|
|
|
|
run: echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
|
2022-11-24 09:05:36 +01:00
|
|
|
# Build
|
2021-03-11 01:41:05 +01:00
|
|
|
- name: Build
|
2021-04-16 14:05:17 +02:00
|
|
|
env:
|
2022-11-24 09:05:36 +01:00
|
|
|
EXT_PHP_RS_TEST: ""
|
2021-11-20 02:19:02 +01:00
|
|
|
run: cargo build --release --all-features --all
|
2022-11-24 09:05:36 +01:00
|
|
|
# Test & lint
|
2021-08-21 15:33:22 +02:00
|
|
|
- name: Test inline examples
|
2022-11-24 09:05:36 +01:00
|
|
|
run: cargo test --release --all --all-features
|
2021-03-11 01:41:05 +01:00
|
|
|
- name: Run rustfmt
|
2022-11-13 09:13:25 +01:00
|
|
|
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
|
2022-11-24 09:05:36 +01:00
|
|
|
run: cargo fmt --all -- --check
|
2021-03-11 01:41:05 +01:00
|
|
|
- name: Run clippy
|
2022-11-13 09:13:25 +01:00
|
|
|
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
|
2022-11-24 09:05:36 +01:00
|
|
|
run: cargo clippy --all -- -D warnings
|
|
|
|
# Docs
|
2022-11-13 09:13:25 +01:00
|
|
|
- name: Run rustdoc
|
|
|
|
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
|
2022-11-24 09:05:36 +01:00
|
|
|
run: cargo rustdoc -- -D warnings
|
2021-10-10 11:57:38 +02:00
|
|
|
- name: Build with docs stub
|
2022-11-13 09:13:25 +01:00
|
|
|
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
|
2022-11-24 09:05:36 +01: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
|
2022-09-10 02:25:59 +02:00
|
|
|
uses: actions/checkout@v3
|
2022-03-06 04:01:27 +01:00
|
|
|
- name: Build
|
|
|
|
uses: ./.github/actions/zts
|