Skip to content

chore(ci): simplify ci, test all features combination #1370

chore(ci): simplify ci, test all features combination

chore(ci): simplify ci, test all features combination #1370

Workflow file for this run

name: Build and Lint
on:
schedule:
# runs every monday at midnight
- cron: "0 0 * * 1"
push:
branches:
- master
pull_request:
env:
# increment this manually to force cache eviction
RUST_CACHE_PREFIX: "v0-rust"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
env:
clang: "17"
php_version: "8.2"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check typos
uses: crate-ci/typos@master
- name: Validate commit messages
run: |
git show-ref
curl -sSfL https://github.com/convco/convco/releases/latest/download/convco-ubuntu.zip | zcat > convco
chmod +x convco
./convco check refs/remotes/origin/master..HEAD
rm convco
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php_version }}
env:
debug: true
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
components: rustfmt, clippy
toolchain: stable
- name: Cache cargo dependencies
uses: Swatinem/rust-cache@v2
with:
prefix-key: ${{ env.RUST_CACHE_PREFIX }}
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/llvm-${{ env.clang }}
key: ubuntu-latest-llvm-${{ env.clang }}
- name: Setup LLVM & Clang
id: clang
uses: KyleMayes/install-llvm-action@v2
with:
version: ${{ env.clang }}
directory: ${{ runner.temp }}/llvm-${{ env.clang }}
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Configure Clang
run: |
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ env.clang }}/lib" >> $GITHUB_ENV
echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ env.clang }}/bin/llvm-config" >> $GITHUB_ENV
- name: Run rustfmt
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all -- -D warnings
# Docs
- name: Run rustdoc
run: cargo rustdoc -- -D warnings
- name: Build with docs stub
env:
DOCS_RS: ""
run: cargo clean && cargo build
test:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
php: ["8.0", "8.1", "8.2", "8.3", "8.4"]
rust: [stable, nightly]
clang: ["15", "17"]
phpts: [ts, nts]
exclude:
- os: macos-latest
clang: "17"
- os: ubuntu-latest
clang: "15"
- os: macos-latest
rust: nightly
- os: ubuntu-latest
rust: nightly
- os: windows-latest
clang: "15"
- os: windows-latest
rust: stable
include:
- os: ubuntu-latest
rust: nightly
clang: "15"
phpts: nts
php: "8.4"
env:
CARGO_TERM_COLOR: always
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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
- name: Install cargo-hack
uses: taiki-e/install-action@v2
with:
tool: cargo-hack
- name: Test
env:
EXT_PHP_RS_TEST: ""
run: cargo ci-test
test-link:
name: Test that requires linking php library
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
php: ["8.2", "8.3", "8.4"]
clang: ["15", "17"]
phpts: [ts, nts]
exclude:
- os: macos-latest
clang: "17"
- os: ubuntu-latest
clang: "15"
- os: windows-latest
clang: "15"
env:
CARGO_TERM_COLOR: always
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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: stable
components: rustfmt, clippy
- run: rustup show
- name: Install cargo-hack
uses: taiki-e/install-action@v2
with:
tool: cargo-hack
- name: Test
env:
EXT_PHP_RS_TEST: ""
run: cargo ci-test-link
test-others:
name: Test others crates not depen
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable, nightly]
env:
CARGO_TERM_COLOR: always
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- name: Install cargo-hack
uses: taiki-e/install-action@v2
with:
tool: cargo-hack
# Test
- name: Test
env:
EXT_PHP_RS_TEST: ""
run: cargo ci-test-other