|
1 | 1 | name: Dashboard CI |
2 | 2 |
|
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + |
3 | 6 | on: |
4 | 7 | push: |
5 | | - branches: [ main, rocketmq-*-dev ] |
| 8 | + branches: [ "main", "rocketmq-*-dev" ] |
6 | 9 | paths: |
7 | 10 | - 'rocketmq-dashboard/**' |
8 | 11 | - '.github/workflows/dashboard-ci.yml' |
9 | 12 | pull_request: |
10 | | - branches: [ main, rocketmq-*-dev ] |
| 13 | + branches: [ "main", "rocketmq-*-dev" ] |
11 | 14 | paths: |
12 | 15 | - 'rocketmq-dashboard/**' |
13 | 16 | - '.github/workflows/dashboard-ci.yml' |
14 | 17 |
|
15 | 18 | env: |
16 | 19 | CARGO_TERM_COLOR: always |
17 | | - RUST_BACKTRACE: 1 |
| 20 | + RUST_BACKTRACE: full |
| 21 | + CI: true |
| 22 | + CARGO_PROFILE_DEV_DEBUG: "false" |
| 23 | + CARGO_PROFILE_TEST_DEBUG: "false" |
| 24 | + CARGO_PROFILE_DEV_OPT_LEVEL: 1 |
| 25 | + CARGO_PROFILE_DEV_OVERFLOW_CHECKS: "false" |
| 26 | + CARGO_TARGET_DIR: target |
18 | 27 |
|
19 | 28 | jobs: |
| 29 | + # ========================= |
| 30 | + # Format + Clippy |
| 31 | + # ========================= |
20 | 32 | check: |
21 | | - name: Check |
| 33 | + name: Check (fmt + clippy) |
22 | 34 | runs-on: ubuntu-latest |
| 35 | + |
23 | 36 | steps: |
24 | | - - uses: actions/checkout@v4 |
25 | | - |
26 | | - - name: Install Rust |
27 | | - uses: dtolnay/rust-toolchain@stable |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Install system dependencies (Ubuntu) |
| 41 | + run: | |
| 42 | + sudo apt-get update |
| 43 | + sudo apt-get install -y libxkbcommon-dev libwayland-dev libvulkan-dev |
| 44 | +
|
| 45 | + - name: Set up Rust nightly |
| 46 | + uses: dtolnay/rust-toolchain@nightly |
28 | 47 | with: |
29 | 48 | components: rustfmt, clippy |
30 | | - |
31 | | - - name: Cache cargo registry |
32 | | - uses: actions/cache@v4 |
33 | | - with: |
34 | | - path: ~/.cargo/registry |
35 | | - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
36 | | - restore-keys: | |
37 | | - ${{ runner.os }}-cargo-registry- |
38 | | - |
39 | | - - name: Cache cargo index |
40 | | - uses: actions/cache@v4 |
41 | | - with: |
42 | | - path: ~/.cargo/git |
43 | | - key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} |
44 | | - restore-keys: | |
45 | | - ${{ runner.os }}-cargo-git- |
46 | | - |
47 | | - - name: Cache cargo build |
48 | | - uses: actions/cache@v4 |
49 | | - with: |
50 | | - path: rocketmq-dashboard/target |
51 | | - key: ${{ runner.os }}-cargo-target-${{ hashFiles('rocketmq-dashboard/**/Cargo.lock') }} |
52 | | - restore-keys: | |
53 | | - ${{ runner.os }}-cargo-target- |
54 | | - |
55 | | - - name: Run cargo check |
56 | | - working-directory: ./rocketmq-dashboard |
57 | | - run: cargo check --workspace --all-targets --all-features |
58 | 49 |
|
59 | | - fmt: |
60 | | - name: Format |
61 | | - runs-on: ubuntu-latest |
62 | | - steps: |
63 | | - - uses: actions/checkout@v4 |
64 | | - |
65 | | - - name: Install Rust |
66 | | - uses: dtolnay/rust-toolchain@stable |
| 50 | + - name: Cache Rust |
| 51 | + uses: Swatinem/rust-cache@v2 |
67 | 52 | with: |
68 | | - components: rustfmt |
69 | | - |
70 | | - - name: Run cargo fmt |
| 53 | + shared-key: dashboard-ubuntu |
| 54 | + workspaces: | |
| 55 | + rocketmq-dashboard |
| 56 | +
|
| 57 | + - name: Format check |
71 | 58 | working-directory: ./rocketmq-dashboard |
72 | 59 | run: cargo fmt --all -- --check |
73 | 60 |
|
74 | | - clippy: |
75 | | - name: Clippy |
76 | | - runs-on: ubuntu-latest |
77 | | - steps: |
78 | | - - uses: actions/checkout@v4 |
79 | | - |
80 | | - - name: Install Rust |
81 | | - uses: dtolnay/rust-toolchain@stable |
82 | | - with: |
83 | | - components: clippy |
84 | | - |
85 | | - - name: Cache cargo registry |
86 | | - uses: actions/cache@v4 |
87 | | - with: |
88 | | - path: ~/.cargo/registry |
89 | | - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
90 | | - restore-keys: | |
91 | | - ${{ runner.os }}-cargo-registry- |
92 | | - |
93 | | - - name: Cache cargo index |
94 | | - uses: actions/cache@v4 |
95 | | - with: |
96 | | - path: ~/.cargo/git |
97 | | - key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} |
98 | | - restore-keys: | |
99 | | - ${{ runner.os }}-cargo-git- |
100 | | - |
101 | | - - name: Cache cargo build |
102 | | - uses: actions/cache@v4 |
103 | | - with: |
104 | | - path: rocketmq-dashboard/target |
105 | | - key: ${{ runner.os }}-cargo-target-clippy-${{ hashFiles('rocketmq-dashboard/**/Cargo.lock') }} |
106 | | - restore-keys: | |
107 | | - ${{ runner.os }}-cargo-target-clippy- |
108 | | - |
109 | | - - name: Run cargo clippy |
| 61 | + - name: Clippy (all features) |
110 | 62 | working-directory: ./rocketmq-dashboard |
111 | | - run: cargo clippy --workspace --all-targets --all-features -- -D warnings |
| 63 | + run: cargo clippy --workspace --no-deps --all-targets --all-features -- -D warnings |
112 | 64 |
|
113 | | - test: |
114 | | - name: Test |
| 65 | + # ========================= |
| 66 | + # Build + Test |
| 67 | + # ========================= |
| 68 | + build-test: |
| 69 | + name: Build & Test (${{ matrix.os }}) |
| 70 | + needs: check |
115 | 71 | runs-on: ${{ matrix.os }} |
| 72 | + |
116 | 73 | strategy: |
117 | 74 | fail-fast: false |
118 | 75 | matrix: |
119 | | - os: [ubuntu-latest, windows-latest, macos-latest] |
120 | | - rust: [stable] |
| 76 | + os: [ ubuntu-latest, macos-latest, windows-latest ] |
| 77 | + |
121 | 78 | steps: |
122 | | - - uses: actions/checkout@v4 |
123 | | - |
124 | | - - name: Install Rust |
125 | | - uses: dtolnay/rust-toolchain@master |
126 | | - with: |
127 | | - toolchain: ${{ matrix.rust }} |
128 | | - |
| 79 | + - name: Checkout |
| 80 | + uses: actions/checkout@v4 |
| 81 | + |
| 82 | + # ---------- Ubuntu ---------- |
129 | 83 | - name: Install system dependencies (Ubuntu) |
130 | | - if: runner.os == 'Linux' |
| 84 | + if: matrix.os == 'ubuntu-latest' |
131 | 85 | run: | |
132 | 86 | sudo apt-get update |
133 | 87 | sudo apt-get install -y libxkbcommon-dev libwayland-dev libvulkan-dev |
134 | | - |
| 88 | +
|
| 89 | + # ---------- macOS ---------- |
135 | 90 | - name: Install system dependencies (macOS) |
136 | | - if: runner.os == 'macOS' |
| 91 | + if: matrix.os == 'macos-latest' |
137 | 92 | run: | |
138 | | - # Vulkan SDK should be pre-installed on GitHub runners |
139 | 93 | echo "macOS system dependencies check" |
140 | | - |
| 94 | +
|
| 95 | + # ---------- Windows ---------- |
141 | 96 | - name: Install system dependencies (Windows) |
142 | | - if: runner.os == 'Windows' |
| 97 | + if: matrix.os == 'windows-latest' |
143 | 98 | run: | |
144 | | - # Vulkan SDK should be pre-installed on GitHub runners |
145 | 99 | echo "Windows system dependencies check" |
146 | | - |
147 | | - - name: Cache cargo registry |
148 | | - uses: actions/cache@v4 |
149 | | - with: |
150 | | - path: ~/.cargo/registry |
151 | | - key: ${{ runner.os }}-${{ matrix.rust }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
152 | | - restore-keys: | |
153 | | - ${{ runner.os }}-${{ matrix.rust }}-cargo-registry- |
154 | | - |
155 | | - - name: Cache cargo index |
156 | | - uses: actions/cache@v4 |
157 | | - with: |
158 | | - path: ~/.cargo/git |
159 | | - key: ${{ runner.os }}-${{ matrix.rust }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} |
160 | | - restore-keys: | |
161 | | - ${{ runner.os }}-${{ matrix.rust }}-cargo-git- |
162 | | - |
163 | | - - name: Cache cargo build |
164 | | - uses: actions/cache@v4 |
| 100 | +
|
| 101 | + - name: Set up Rust nightly |
| 102 | + uses: dtolnay/rust-toolchain@nightly |
| 103 | + |
| 104 | + - name: Cache Rust |
| 105 | + uses: Swatinem/rust-cache@v2 |
165 | 106 | with: |
166 | | - path: rocketmq-dashboard/target |
167 | | - key: ${{ runner.os }}-${{ matrix.rust }}-cargo-target-${{ hashFiles('rocketmq-dashboard/**/Cargo.lock') }} |
168 | | - restore-keys: | |
169 | | - ${{ runner.os }}-${{ matrix.rust }}-cargo-target- |
170 | | - |
171 | | - - name: Run tests (common) |
| 107 | + shared-key: dashboard-${{ matrix.os }} |
| 108 | + workspaces: | |
| 109 | + rocketmq-dashboard |
| 110 | +
|
| 111 | + - name: Build (all features) |
| 112 | + working-directory: ./rocketmq-dashboard |
| 113 | + run: cargo build --workspace --all-features |
| 114 | + |
| 115 | + - name: Test (common - all features) |
172 | 116 | working-directory: ./rocketmq-dashboard/rocketmq-dashboard-common |
173 | 117 | run: cargo test --all-features |
174 | | - |
| 118 | + |
175 | 119 | - name: Build GPUI (without tests due to headless environment) |
176 | 120 | working-directory: ./rocketmq-dashboard/rocketmq-dashboard-gpui |
177 | 121 | run: cargo build --all-features |
0 commit comments