Skip to content

Commit 50f9633

Browse files
committed
[ISSUE #5990]🔨Add CI workflow for RocketMQ Dashboard with checks, formatting, and testing
1 parent 3c35133 commit 50f9633

File tree

1 file changed

+72
-128
lines changed

1 file changed

+72
-128
lines changed

.github/workflows/dashboard-ci.yml

Lines changed: 72 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,177 +1,121 @@
11
name: Dashboard CI
22

3+
permissions:
4+
contents: read
5+
36
on:
47
push:
5-
branches: [ main, rocketmq-*-dev ]
8+
branches: [ "main", "rocketmq-*-dev" ]
69
paths:
710
- 'rocketmq-dashboard/**'
811
- '.github/workflows/dashboard-ci.yml'
912
pull_request:
10-
branches: [ main, rocketmq-*-dev ]
13+
branches: [ "main", "rocketmq-*-dev" ]
1114
paths:
1215
- 'rocketmq-dashboard/**'
1316
- '.github/workflows/dashboard-ci.yml'
1417

1518
env:
1619
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
1827

1928
jobs:
29+
# =========================
30+
# Format + Clippy
31+
# =========================
2032
check:
21-
name: Check
33+
name: Check (fmt + clippy)
2234
runs-on: ubuntu-latest
35+
2336
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
2847
with:
2948
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
5849

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
6752
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
7158
working-directory: ./rocketmq-dashboard
7259
run: cargo fmt --all -- --check
7360

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)
11062
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
11264

113-
test:
114-
name: Test
65+
# =========================
66+
# Build + Test
67+
# =========================
68+
build-test:
69+
name: Build & Test (${{ matrix.os }})
70+
needs: check
11571
runs-on: ${{ matrix.os }}
72+
11673
strategy:
11774
fail-fast: false
11875
matrix:
119-
os: [ubuntu-latest, windows-latest, macos-latest]
120-
rust: [stable]
76+
os: [ ubuntu-latest, macos-latest, windows-latest ]
77+
12178
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 ----------
12983
- name: Install system dependencies (Ubuntu)
130-
if: runner.os == 'Linux'
84+
if: matrix.os == 'ubuntu-latest'
13185
run: |
13286
sudo apt-get update
13387
sudo apt-get install -y libxkbcommon-dev libwayland-dev libvulkan-dev
134-
88+
89+
# ---------- macOS ----------
13590
- name: Install system dependencies (macOS)
136-
if: runner.os == 'macOS'
91+
if: matrix.os == 'macos-latest'
13792
run: |
138-
# Vulkan SDK should be pre-installed on GitHub runners
13993
echo "macOS system dependencies check"
140-
94+
95+
# ---------- Windows ----------
14196
- name: Install system dependencies (Windows)
142-
if: runner.os == 'Windows'
97+
if: matrix.os == 'windows-latest'
14398
run: |
144-
# Vulkan SDK should be pre-installed on GitHub runners
14599
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
165106
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)
172116
working-directory: ./rocketmq-dashboard/rocketmq-dashboard-common
173117
run: cargo test --all-features
174-
118+
175119
- name: Build GPUI (without tests due to headless environment)
176120
working-directory: ./rocketmq-dashboard/rocketmq-dashboard-gpui
177121
run: cargo build --all-features

0 commit comments

Comments
 (0)