11name : Build and Lint
22on :
3+ schedule :
4+ # runs every monday at midnight
5+ - cron : " 0 0 * * 1"
36 push :
47 branches :
58 - master
1215 strategy :
1316 matrix :
1417 os : [ubuntu-latest, macos-latest, windows-latest]
15- php : [' 8.0', ' 8.1' ]
18+ php : [" 8.0", " 8.1" ]
1619 rust : [stable, nightly]
20+ clang : ["14"]
1721 phpts : [ts, nts]
1822 exclude :
1923 # ext-php-rs requires nightly Rust when on Windows.
2428 phpts : ts
2529 - os : ubuntu-latest
2630 phpts : ts
31+ env :
32+ CARGO_TERM_COLOR : always
2733 steps :
2834 - name : Checkout code
2935 uses : actions/checkout@v3
@@ -34,59 +40,67 @@ jobs:
3440 env :
3541 phpts : ${{ matrix.phpts }}
3642 - name : Setup Rust
37- uses : actions-rs/ toolchain@v1
43+ uses : dtolnay/rust- toolchain@master
3844 with :
3945 toolchain : ${{ matrix.rust }}
40- override : true
4146 components : rustfmt, clippy
42- - name : Setup LLVM & Clang
47+ - run : rustup show
48+ - name : Cache cargo dependencies
49+ uses : Swatinem/rust-cache@v2
50+ # Uncomment the following if statement if caching nightly deps
51+ # ends up causing too much cache invalidation.
52+ # if: matrix.rust == 'stable'
53+ with :
54+ # increment this manually to force cache eviction
55+ prefix-key : " v0-rust"
56+ # LLVM & Clang
57+ - name : Cache LLVM and Clang
58+ id : cache-llvm
59+ uses : actions/cache@v3
4360 if : " !contains(matrix.os, 'windows')"
61+ with :
62+ path : ${{ runner.temp }}/llvm-${{ matrix.clang }}
63+ key : ${{ matrix.os }}-llvm-${{ matrix.clang }}
64+ - name : Setup LLVM & Clang
4465 id : clang
4566 uses : KyleMayes/install-llvm-action@v1
67+ if : " !contains(matrix.os, 'windows')"
4668 with :
47- version : ' 13.0'
48- directory : ${{ runner.temp }}/llvm
69+ version : ${{ matrix.clang }}
70+ directory : ${{ runner.temp }}/llvm-${{ matrix.clang }}
71+ cached : ${{ steps.cache-llvm.outputs.cache-hit }}
4972 - name : Configure Clang
5073 if : " !contains(matrix.os, 'windows')"
5174 run : |
52- echo "LIBCLANG_PATH=${{ runner.temp }}/llvm/lib" >> $GITHUB_ENV
75+ echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }} /lib" >> $GITHUB_ENV
5376 echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
77+ echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/bin/llvm-config" >> $GITHUB_ENV
5478 - name : Configure Clang (macOS only)
5579 if : " contains(matrix.os, 'macos')"
5680 run : echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
81+ # Build
5782 - name : Build
5883 env :
59- EXT_PHP_RS_TEST :
84+ EXT_PHP_RS_TEST : " "
6085 run : cargo build --release --all-features --all
86+ # Test & lint
6187 - name : Test inline examples
62- uses : actions-rs/cargo@v1
63- with :
64- command : test
65- args : --release --all --all-features
88+ run : cargo test --release --all --all-features
6689 - name : Run rustfmt
67- uses : actions-rs/cargo@v1
68- with :
69- command : fmt
70- args : --all -- --check
7190 if : matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
91+ run : cargo fmt --all -- --check
7292 - name : Run clippy
73- uses : actions-rs/cargo@v1
74- with :
75- command : clippy
76- args : --all -- -D warnings
7793 if : matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
94+ run : cargo clippy --all -- -D warnings
95+ # Docs
7896 - name : Run rustdoc
79- uses : actions-rs/cargo@v1
80- with :
81- command : rustdoc
82- args : -- -D warnings
8397 if : matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
98+ run : cargo rustdoc -- -D warnings
8499 - name : Build with docs stub
85- env :
86- DOCS_RS :
87- run :
88- cargo clean && cargo build
89100 if : matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
101+ env :
102+ DOCS_RS : " "
103+ run : cargo clean && cargo build
90104 build-zts :
91105 name : Build with ZTS
92106 runs-on : ubuntu-latest
0 commit comments