Skip to content

Commit 049f776

Browse files
committed
Merge remote-tracking branch 'origin/master' into feat-integration-tests
2 parents 411e9a0 + 3d66f17 commit 049f776

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+6143
-716
lines changed

.github/actions/embed/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM php:8.2-bullseye
2+
3+
WORKDIR /tmp
4+
5+
RUN apt update -y && apt upgrade -y
6+
RUN apt install lsb-release wget gnupg software-properties-common -y
7+
RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
8+
9+
ENV RUSTUP_HOME=/rust
10+
ENV CARGO_HOME=/cargo
11+
ENV PATH=/cargo/bin:/rust/bin:$PATH
12+
13+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path
14+
15+
ENTRYPOINT [ "/cargo/bin/cargo", "test", "--lib", "--release", "--all-features" ]

.github/actions/embed/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: 'PHP Embed and Rust'
2+
description: 'Builds the crate after installing the latest PHP with php embed and stable Rust.'
3+
runs:
4+
using: 'docker'
5+
image: 'Dockerfile'

.github/actions/zts/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:zts
1+
FROM php:8.2-zts-bullseye
22

33
WORKDIR /tmp
44

.github/workflows/build.yml

Lines changed: 64 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Build and Lint
22
on:
3+
schedule:
4+
# runs every monday at midnight
5+
- cron: "0 0 * * 1"
36
push:
47
branches:
58
- master
@@ -12,8 +15,9 @@ jobs:
1215
strategy:
1316
matrix:
1417
os: [ubuntu-latest, macos-latest, windows-latest]
15-
php: ['8.0', '8.1']
18+
php: ["8.0", "8.1", "8.2", "8.3"]
1619
rust: [stable, nightly]
20+
clang: ["15", "17"]
1721
phpts: [ts, nts]
1822
exclude:
1923
# ext-php-rs requires nightly Rust when on Windows.
@@ -24,66 +28,99 @@ jobs:
2428
phpts: ts
2529
- os: ubuntu-latest
2630
phpts: ts
31+
- os: macos-latest
32+
clang: "17"
33+
- os: ubuntu-latest
34+
clang: "15"
35+
- os: windows-latest
36+
clang: "15"
37+
env:
38+
CARGO_TERM_COLOR: always
2739
steps:
2840
- name: Checkout code
29-
uses: actions/checkout@v2
41+
uses: actions/checkout@v3
3042
- name: Setup PHP
3143
uses: shivammathur/setup-php@v2
3244
with:
3345
php-version: ${{ matrix.php }}
3446
env:
3547
phpts: ${{ matrix.phpts }}
48+
debug: true
3649
- name: Setup Rust
37-
uses: actions-rs/toolchain@v1
50+
uses: dtolnay/rust-toolchain@master
3851
with:
3952
toolchain: ${{ matrix.rust }}
40-
override: true
4153
components: rustfmt, clippy
42-
- name: Setup LLVM & Clang
54+
- run: rustup show
55+
- name: Cache cargo dependencies
56+
uses: Swatinem/rust-cache@v2
57+
# Uncomment the following if statement if caching nightly deps
58+
# ends up causing too much cache invalidation.
59+
# if: matrix.rust == 'stable'
60+
with:
61+
# increment this manually to force cache eviction
62+
prefix-key: "v0-rust"
63+
# LLVM & Clang
64+
- name: Cache LLVM and Clang
65+
id: cache-llvm
66+
uses: actions/cache@v3
4367
if: "!contains(matrix.os, 'windows')"
68+
with:
69+
path: ${{ runner.temp }}/llvm-${{ matrix.clang }}
70+
key: ${{ matrix.os }}-llvm-${{ matrix.clang }}
71+
- name: Setup LLVM & Clang
4472
id: clang
4573
uses: KyleMayes/install-llvm-action@v1
74+
if: "!contains(matrix.os, 'windows')"
4675
with:
47-
version: '13.0'
48-
directory: ${{ runner.temp }}/llvm
76+
version: ${{ matrix.clang }}
77+
directory: ${{ runner.temp }}/llvm-${{ matrix.clang }}
78+
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
4979
- name: Configure Clang
5080
if: "!contains(matrix.os, 'windows')"
5181
run: |
52-
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm/lib" >> $GITHUB_ENV
82+
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/lib" >> $GITHUB_ENV
5383
echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
84+
echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/bin/llvm-config" >> $GITHUB_ENV
5485
- name: Configure Clang (macOS only)
5586
if: "contains(matrix.os, 'macos')"
5687
run: echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
88+
# Build
5789
- name: Build
5890
env:
59-
EXT_PHP_RS_TEST:
60-
run: cargo build --release --all-features --all
91+
EXT_PHP_RS_TEST: ""
92+
run: cargo build --release --features closure,anyhow --all
93+
# Test & lint
6194
- name: Test inline examples
62-
uses: actions-rs/cargo@v1
63-
with:
64-
command: test
65-
args: --release --all --all-features
95+
run: cargo test --release --all --features closure,anyhow
6696
- name: Run rustfmt
67-
uses: actions-rs/cargo@v1
68-
with:
69-
command: fmt
70-
args: --all -- --check
97+
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
98+
run: cargo fmt --all -- --check
7199
- name: Run clippy
72-
uses: actions-rs/cargo@v1
73-
with:
74-
command: clippy
75-
args: --all -- -D warnings
100+
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
101+
run: cargo clippy --all -- -D warnings
102+
# Docs
103+
- name: Run rustdoc
104+
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
105+
run: cargo rustdoc -- -D warnings
76106
- name: Build with docs stub
77-
if: "contains(matrix.os, 'ubuntu') && matrix.php == '8.1'"
107+
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
78108
env:
79-
DOCS_RS:
80-
run:
81-
cargo clean && cargo build
109+
DOCS_RS: ""
110+
run: cargo clean && cargo build
82111
build-zts:
83112
name: Build with ZTS
84113
runs-on: ubuntu-latest
85114
steps:
86115
- name: Checkout code
87-
uses: actions/checkout@v2
116+
uses: actions/checkout@v3
88117
- name: Build
89118
uses: ./.github/actions/zts
119+
test-embed:
120+
name: Test with embed
121+
runs-on: ubuntu-latest
122+
steps:
123+
- name: Checkout code
124+
uses: actions/checkout@v3
125+
- name: Test
126+
uses: ./.github/actions/embed

.github/workflows/docs.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,48 @@
11
name: Deploy documentation
22
on:
33
workflow_dispatch:
4+
# runs every monday at midnight
5+
schedule:
6+
- cron: "0 0 * * 1"
47
push:
58
branches:
69
- master
710

811
jobs:
912
docs:
1013
name: Build and Deploy
11-
runs-on: ubuntu-latest
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: ["ubuntu-latest"]
18+
php: ["8.2"]
19+
clang: ["17"]
20+
mdbook: ["latest"]
1221
steps:
1322
- name: Checkout code
14-
uses: actions/checkout@v2
23+
uses: actions/checkout@v3
1524
- name: Setup PHP
1625
uses: shivammathur/setup-php@v2
1726
with:
18-
php-version: 8.0
27+
php-version: ${{ matrix.php }}
1928
- name: Setup Rust
20-
uses: actions-rs/toolchain@v1
29+
uses: dtolnay/rust-toolchain@nightly
30+
- name: Cache LLVM and Clang
31+
id: cache-llvm
32+
uses: actions/cache@v3
2133
with:
22-
toolchain: nightly
23-
override: true
34+
path: ${{ runner.temp }}/llvm-${{ matrix.clang }}
35+
key: ${{ matrix.os }}-llvm-${{ matrix.clang }}
2436
- name: Setup LLVM & Clang
2537
uses: KyleMayes/install-llvm-action@v1
2638
with:
27-
version: 11.0
28-
directory: ${{ runner.temp }}/llvm-11.0
39+
version: ${{ matrix.clang }}
40+
directory: ${{ runner.temp }}/llvm-${{ matrix.clang }}
41+
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
2942
- name: Install mdbook
3043
uses: peaceiris/actions-mdbook@v1
3144
with:
32-
mdbook-version: latest
45+
mdbook-version: ${{ matrix.mdbook }}
3346
- name: Build guide
3447
run: mdbook build guide
3548
- name: Publish docs
@@ -38,4 +51,4 @@ jobs:
3851
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3952
BRANCH: gh-pages
4053
FOLDER: guide/book
41-
CLEAN: true
54+
CLEAN: true

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
Cargo.lock
33
/.vscode
44
/.idea
5-
expand.rs
5+
/tmp
6+
expand.rs

0 commit comments

Comments
 (0)