|
76 | 76 | env: |
77 | 77 | DOCS_RS: "" |
78 | 78 | run: cargo clean && cargo build |
79 | | - build: |
80 | | - name: Build and Test |
| 79 | + |
| 80 | + test: |
| 81 | + name: Build and test |
81 | 82 | runs-on: ${{ matrix.os }} |
82 | 83 | strategy: |
83 | 84 | matrix: |
@@ -151,8 +152,114 @@ jobs: |
151 | 152 | uses: taiki-e/install-action@v2 |
152 | 153 | with: |
153 | 154 | tool: cargo-hack |
154 | | - # Test |
155 | | - - name: Test features matrix |
| 155 | + - name: Test |
156 | 156 | env: |
157 | 157 | EXT_PHP_RS_TEST: "" |
158 | 158 | run: cargo ci-test |
| 159 | + |
| 160 | + test-link: |
| 161 | + name: Test that requires linking php library |
| 162 | + runs-on: ${{ matrix.os }} |
| 163 | + strategy: |
| 164 | + matrix: |
| 165 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 166 | + php: ["8.2", "8.3", "8.4"] |
| 167 | + clang: ["15", "17"] |
| 168 | + phpts: [ts, nts] |
| 169 | + exclude: |
| 170 | + # ext-php-rs requires nightly Rust when on Windows. |
| 171 | + - os: windows-latest |
| 172 | + rust: stable |
| 173 | + - os: macos-latest |
| 174 | + clang: "17" |
| 175 | + - os: ubuntu-latest |
| 176 | + clang: "15" |
| 177 | + - os: windows-latest |
| 178 | + clang: "15" |
| 179 | + env: |
| 180 | + CARGO_TERM_COLOR: always |
| 181 | + steps: |
| 182 | + - name: Checkout code |
| 183 | + uses: actions/checkout@v4 |
| 184 | + - name: Setup PHP |
| 185 | + uses: shivammathur/setup-php@v2 |
| 186 | + with: |
| 187 | + php-version: ${{ matrix.php }} |
| 188 | + env: |
| 189 | + phpts: ${{ matrix.phpts }} |
| 190 | + debug: true |
| 191 | + - name: Setup Rust |
| 192 | + uses: dtolnay/rust-toolchain@master |
| 193 | + with: |
| 194 | + toolchain: stable |
| 195 | + components: rustfmt, clippy |
| 196 | + - run: rustup show |
| 197 | + - name: Cache cargo dependencies |
| 198 | + uses: Swatinem/rust-cache@v2 |
| 199 | + # Uncomment the following if statement if caching nightly deps |
| 200 | + # ends up causing too much cache invalidation. |
| 201 | + # if: matrix.rust == 'stable' |
| 202 | + with: |
| 203 | + # increment this manually to force cache eviction |
| 204 | + prefix-key: ${{ env.RUST_CACHE_PREFIX }} |
| 205 | + # LLVM & Clang |
| 206 | + - name: Cache LLVM and Clang |
| 207 | + id: cache-llvm |
| 208 | + uses: actions/cache@v4 |
| 209 | + # Macos build doesn't work with clang < 18. As a build for version 18 is not available, we skip the setup |
| 210 | + if: "!contains(matrix.os, 'windows') && !contains(matrix.os, 'macos')" |
| 211 | + with: |
| 212 | + path: ${{ runner.temp }}/llvm-${{ matrix.clang }} |
| 213 | + key: ${{ matrix.os }}-llvm-${{ matrix.clang }} |
| 214 | + - name: Setup LLVM & Clang |
| 215 | + id: clang |
| 216 | + uses: KyleMayes/install-llvm-action@v2 |
| 217 | + # Macos build doesn't work with clang < 18. As a build for version 18 is not available, we skip the setup |
| 218 | + if: "!contains(matrix.os, 'windows') && !contains(matrix.os, 'macos')" |
| 219 | + with: |
| 220 | + version: ${{ matrix.clang }} |
| 221 | + directory: ${{ runner.temp }}/llvm-${{ matrix.clang }} |
| 222 | + cached: ${{ steps.cache-llvm.outputs.cache-hit }} |
| 223 | + - name: Configure Clang |
| 224 | + # Macos build doesn't work with clang < 18. As a build for version 18 is not available, we skip the setup |
| 225 | + if: "!contains(matrix.os, 'windows') && !contains(matrix.os, 'macos')" |
| 226 | + run: | |
| 227 | + echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/lib" >> $GITHUB_ENV |
| 228 | + echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV |
| 229 | + echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/bin/llvm-config" >> $GITHUB_ENV |
| 230 | + - name: Install cargo-hack |
| 231 | + uses: taiki-e/install-action@v2 |
| 232 | + with: |
| 233 | + tool: cargo-hack |
| 234 | + - name: Test |
| 235 | + env: |
| 236 | + EXT_PHP_RS_TEST: "" |
| 237 | + run: cargo ci-test-link |
| 238 | + |
| 239 | + test-others: |
| 240 | + name: Test others crates not depen |
| 241 | + runs-on: ${{ matrix.os }} |
| 242 | + strategy: |
| 243 | + matrix: |
| 244 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 245 | + rust: [stable, nightly] |
| 246 | + env: |
| 247 | + CARGO_TERM_COLOR: always |
| 248 | + steps: |
| 249 | + - name: Checkout code |
| 250 | + uses: actions/checkout@v4 |
| 251 | + - name: Setup Rust |
| 252 | + uses: dtolnay/rust-toolchain@master |
| 253 | + with: |
| 254 | + toolchain: ${{ matrix.rust }} |
| 255 | + components: rustfmt, clippy |
| 256 | + - run: rustup show |
| 257 | + - name: Install cargo-hack |
| 258 | + uses: taiki-e/install-action@v2 |
| 259 | + with: |
| 260 | + tool: cargo-hack |
| 261 | + # Test |
| 262 | + - name: Test |
| 263 | + env: |
| 264 | + EXT_PHP_RS_TEST: "" |
| 265 | + run: cargo ci-test-other |
0 commit comments