77 branches :
88 - master
99 pull_request :
10+ env :
11+ RUST_CACHE_PREFIX : " v0-rust"
1012
1113jobs :
14+ lint :
15+ name : Lint
16+ runs-on : ubuntu-latest
17+ env :
18+ clang : " 17"
19+ php_version : " 8.2"
20+ steps :
21+ - name : Checkout
22+ uses : actions/checkout@v4
23+ with :
24+ fetch-depth : 0
25+ - name : Check typos
26+ uses : crate-ci/typos@master
27+ - name : Validate commit messages
28+ run : |
29+ git show-ref
30+ curl -sSfL https://github.com/convco/convco/releases/latest/download/convco-ubuntu.zip | zcat > convco
31+ chmod +x convco
32+ ./convco check refs/remotes/origin/master..HEAD
33+ rm convco
34+ - name : Setup PHP
35+ uses : shivammathur/setup-php@v2
36+ with :
37+ php-version : ${{ env.php_version }}
38+ env :
39+ debug : true
40+ - name : Setup Rust
41+ uses : dtolnay/rust-toolchain@master
42+ with :
43+ components : rustfmt, clippy
44+ toolchain : stable
45+ - name : Cache cargo dependencies
46+ uses : Swatinem/rust-cache@v2
47+ with :
48+ # increment this manually to force cache eviction
49+ prefix-key : ${{ env.RUST_CACHE_PREFIX }}
50+ - name : Cache LLVM and Clang
51+ id : cache-llvm
52+ uses : actions/cache@v3
53+ with :
54+ path : ${{ runner.temp }}/llvm-${{ env.clang }}
55+ key : ubuntu-latest-llvm-${{ env.clang }}
56+ - name : Setup LLVM & Clang
57+ id : clang
58+ uses : KyleMayes/install-llvm-action@v2
59+ with :
60+ version : ${{ env.clang }}
61+ directory : ${{ runner.temp }}/llvm-${{ env.clang }}
62+ cached : ${{ steps.cache-llvm.outputs.cache-hit }}
63+ - name : Configure Clang
64+ run : |
65+ echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ env.clang }}/lib" >> $GITHUB_ENV
66+ echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
67+ echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ env.clang }}/bin/llvm-config" >> $GITHUB_ENV
68+ - name : Run rustfmt
69+ run : cargo fmt --all -- --check
70+ - name : Run clippy
71+ run : cargo clippy --all -- -D warnings
72+ # Docs
73+ - name : Run rustdoc
74+ run : cargo rustdoc -- -D warnings
75+ - name : Build with docs stub
76+ env :
77+ DOCS_RS : " "
78+ run : cargo clean && cargo build
1279 build :
1380 name : Build and Test
1481 runs-on : ${{ matrix.os }}
50117 uses : dtolnay/rust-toolchain@master
51118 with :
52119 toolchain : ${{ matrix.rust }}
53- components : rustfmt, clippy
54120 - run : rustup show
55121 - name : Cache cargo dependencies
56122 uses : Swatinem/rust-cache@v2
59125 # if: matrix.rust == 'stable'
60126 with :
61127 # increment this manually to force cache eviction
62- prefix-key : " v0-rust "
128+ prefix-key : ${{ env.RUST_CACHE_PREFIX }}
63129 # LLVM & Clang
64130 - name : Cache LLVM and Clang
65131 id : cache-llvm
77143 with :
78144 version : ${{ matrix.clang }}
79145 directory : ${{ runner.temp }}/llvm-${{ matrix.clang }}
146+ cached : ${{ steps.cache-llvm.outputs.cache-hit }}
80147 - name : Configure Clang
81148 # Macos build doesn't work with clang < 18. As a build for version 18 is not available, we skip the setup
82149 if : " !contains(matrix.os, 'windows') && !contains(matrix.os, 'macos')"
@@ -89,24 +156,9 @@ jobs:
89156 env :
90157 EXT_PHP_RS_TEST : " "
91158 run : cargo build --release --features closure,anyhow --all
92- # Test & lint
159+ # Test
93160 - name : Test inline examples
94161 run : cargo test --release --all --features closure,anyhow --no-fail-fast
95- - name : Run rustfmt
96- if : matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
97- run : cargo fmt --all -- --check
98- - name : Run clippy
99- if : matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
100- run : cargo clippy --all -- -D warnings
101- # Docs
102- - name : Run rustdoc
103- if : matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
104- run : cargo rustdoc -- -D warnings
105- - name : Build with docs stub
106- if : matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
107- env :
108- DOCS_RS : " "
109- run : cargo clean && cargo build
110162 build-zts :
111163 name : Build with ZTS
112164 runs-on : ubuntu-latest
0 commit comments