|
7 | 7 | branches: |
8 | 8 | - master |
9 | 9 | pull_request: |
| 10 | +env: |
| 11 | + RUST_CACHE_PREFIX: "v0-rust" |
10 | 12 |
|
11 | 13 | jobs: |
| 14 | + lint: |
| 15 | + name: Lint |
| 16 | + runs-on: ubuntu-latest |
| 17 | + env: |
| 18 | + clang: "17" |
| 19 | + php_version: "8.3" |
| 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 | + - name: Configure Clang |
| 63 | + run: | |
| 64 | + echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ env.clang }}/lib" >> $GITHUB_ENV |
| 65 | + echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV |
| 66 | + echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ env.clang }}/bin/llvm-config" >> $GITHUB_ENV |
| 67 | + - name: Run rustfmt |
| 68 | + run: cargo fmt --all -- --check |
| 69 | + - name: Run clippy |
| 70 | + run: cargo clippy --all -- -D warnings |
| 71 | + # Docs |
| 72 | + - name: Run rustdoc |
| 73 | + run: cargo rustdoc -- -D warnings |
| 74 | + - name: Build with docs stub |
| 75 | + env: |
| 76 | + DOCS_RS: "" |
| 77 | + run: cargo clean && cargo build |
12 | 78 | build: |
13 | 79 | name: Build and Test |
14 | 80 | runs-on: ${{ matrix.os }} |
|
59 | 125 | # if: matrix.rust == 'stable' |
60 | 126 | with: |
61 | 127 | # increment this manually to force cache eviction |
62 | | - prefix-key: "v0-rust" |
| 128 | + prefix-key: ${{ env.RUST_CACHE_PREFIX }} |
63 | 129 | # LLVM & Clang |
64 | 130 | - name: Cache LLVM and Clang |
65 | 131 | id: cache-llvm |
@@ -89,24 +155,9 @@ jobs: |
89 | 155 | env: |
90 | 156 | EXT_PHP_RS_TEST: "" |
91 | 157 | run: cargo build --release --features closure,anyhow --all |
92 | | - # Test & lint |
| 158 | + # Test |
93 | 159 | - name: Test inline examples |
94 | 160 | 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 |
110 | 161 | build-zts: |
111 | 162 | name: Build with ZTS |
112 | 163 | runs-on: ubuntu-latest |
|
0 commit comments