|
25 | 25 | CARGO_TERM_COLOR: always |
26 | 26 |
|
27 | 27 | steps: |
| 28 | + - name: Restore cache |
| 29 | + id: cache-restore |
| 30 | + uses: actions/cache/restore@v4 |
| 31 | + with: |
| 32 | + path: | |
| 33 | + /home/runner/.cargo/bin/buck2 |
| 34 | + /home/runner/.cargo/bin/reindeer |
| 35 | + key: buck2-binary |
| 36 | + |
28 | 37 | - name: Checkout repository |
29 | 38 | uses: actions/checkout@v4 |
30 | 39 | with: |
|
34 | 43 | uses: actions-rust-lang/setup-rust-toolchain@v1 |
35 | 44 | with: |
36 | 45 | components: clippy rustfmt |
| 46 | + cache-workspaces: | |
| 47 | + ./project |
| 48 | + cache-directories: | |
| 49 | + ./project/target |
| 50 | +
|
| 51 | + - name: Install Buck2 |
| 52 | + if: ${{ steps.cache-restore.outputs.cache-hit != 'true' }} |
| 53 | + run: | |
| 54 | + curl https://github.com/facebook/buck2/releases/download/latest/buck2-x86_64-unknown-linux-gnu.zst --output "${{runner.temp}}/buck2-x86_64-unknown-linux-gnu.zst" --location --silent --show-error --fail --retry 5 |
| 55 | + zstd -d "${{runner.temp}}/buck2-x86_64-unknown-linux-gnu.zst" -o $HOME/.cargo/bin/buck2 |
| 56 | + chmod +x $HOME/.cargo/bin/buck2 |
| 57 | + rm -f "${{runner.temp}}/buck2-x86_64-unknown-linux-gnu.zst" |
| 58 | + shell: bash |
| 59 | + |
| 60 | + - name: Install Reindeer |
| 61 | + if: ${{ steps.cache-restore.outputs.cache-hit != 'true' }} |
| 62 | + run: cargo install --locked --git https://github.com/facebookincubator/reindeer reindeer |
| 63 | + shell: bash |
| 64 | + |
| 65 | + - name: Save cache |
| 66 | + if: ${{ steps.cache-restore.outputs.cache-hit != 'true' }} |
| 67 | + uses: actions/cache/save@v4 |
| 68 | + with: |
| 69 | + path: | |
| 70 | + /home/runner/.cargo/bin/buck2 |
| 71 | + /home/runner/.cargo/bin/reindeer |
| 72 | + key: buck2-binary |
37 | 73 |
|
38 | 74 | format: |
39 | 75 | name: Rustfmt Check |
@@ -99,17 +135,11 @@ jobs: |
99 | 135 | reindeer --third-party-dir third-party buckify |
100 | 136 | buck2 build //project/... |
101 | 137 |
|
102 | | - - name: Cache buck-out |
103 | | - uses: actions/cache/save@v4 |
104 | | - with: |
105 | | - path: ./buck-out |
106 | | - key: buck2-cache-${{ github.run_id }}-${{ github.run_attempt }} |
107 | | - |
108 | 138 | test: |
109 | 139 | name: Buck2 Test |
110 | 140 |
|
111 | 141 | runs-on: ubuntu-latest |
112 | | - needs: build |
| 142 | + needs: setup |
113 | 143 |
|
114 | 144 | steps: |
115 | 145 | - name: Checkout repository |
|
0 commit comments