|
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 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + - name: Check typos |
| 25 | + uses: crate-ci/typos@master |
| 26 | + - name: Validate commit messages |
| 27 | + run: | |
| 28 | + git show-ref |
| 29 | + curl -sSfL https://github.com/convco/convco/releases/latest/download/convco-ubuntu.zip | zcat > convco |
| 30 | + chmod +x convco |
| 31 | + ./convco check refs/remotes/origin/master..HEAD |
| 32 | + rm convco |
| 33 | + - name: Setup PHP |
| 34 | + uses: shivammathur/setup-php@v2 |
| 35 | + with: |
| 36 | + php-version: '8.2' |
| 37 | + env: |
| 38 | + debug: true |
| 39 | + - name: Setup Rust |
| 40 | + uses: dtolnay/rust-toolchain@master |
| 41 | + with: |
| 42 | + components: rustfmt, clippy |
| 43 | + toolchain: stable |
| 44 | + - name: Cache cargo dependencies |
| 45 | + uses: Swatinem/rust-cache@v2 |
| 46 | + with: |
| 47 | + # increment this manually to force cache eviction |
| 48 | + prefix-key: ${{ env.RUST_CACHE_PREFIX }} |
| 49 | + - name: Cache LLVM and Clang |
| 50 | + id: cache-llvm |
| 51 | + uses: actions/cache@v3 |
| 52 | + with: |
| 53 | + path: ${{ runner.temp }}/llvm-{{ env.clang }} |
| 54 | + key: ubuntu-latest-llvm-${{ env.clang }} |
| 55 | + - name: Setup LLVM & Clang |
| 56 | + id: clang |
| 57 | + uses: KyleMayes/install-llvm-action@v2 |
| 58 | + with: |
| 59 | + version: ${{ env.clang }} |
| 60 | + directory: ${{ runner.temp }}/llvm-${{ env.clang }} |
| 61 | + - name: Configure Clang |
| 62 | + run: | |
| 63 | + echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ env.clang }}/lib" >> $GITHUB_ENV |
| 64 | + echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV |
| 65 | + echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ env.clang }}/bin/llvm-config" >> $GITHUB_ENV |
| 66 | + - name: Run rustfmt |
| 67 | + run: cargo fmt --all -- --check |
| 68 | + - name: Run clippy |
| 69 | + run: cargo clippy --all -- -D warnings |
12 | 70 | build: |
13 | 71 | name: Build and Test |
14 | 72 | runs-on: ${{ matrix.os }} |
|
59 | 117 | # if: matrix.rust == 'stable' |
60 | 118 | with: |
61 | 119 | # increment this manually to force cache eviction |
62 | | - prefix-key: "v0-rust" |
| 120 | + prefix-key: ${{ env.RUST_CACHE_PREFIX }} |
63 | 121 | # LLVM & Clang |
64 | 122 | - name: Cache LLVM and Clang |
65 | 123 | id: cache-llvm |
@@ -89,15 +147,9 @@ jobs: |
89 | 147 | env: |
90 | 148 | EXT_PHP_RS_TEST: "" |
91 | 149 | run: cargo build --release --features closure,anyhow --all |
92 | | - # Test & lint |
| 150 | + # Test |
93 | 151 | - name: Test inline examples |
94 | 152 | 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 | 153 | # Docs |
102 | 154 | - name: Run rustdoc |
103 | 155 | if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2' |
|
0 commit comments