|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +name: MCP Bash Server CI |
| 19 | + |
| 20 | +on: |
| 21 | + push: |
| 22 | + paths: |
| 23 | + - 'mcp-servers/mcp-bash-server/**' |
| 24 | + - '.github/workflows/mcp-bashserver-test.yml' |
| 25 | + pull_request: |
| 26 | + paths: |
| 27 | + - 'mcp-servers/mcp-bash-server/**' |
| 28 | + - '.github/workflows/mcp-bashserver-test.yml' |
| 29 | + |
| 30 | +env: |
| 31 | + CARGO_TERM_COLOR: always |
| 32 | + RUST_VERSION: 1.88.0 |
| 33 | + |
| 34 | +jobs: |
| 35 | + test: |
| 36 | + name: Test MCP Bash Server |
| 37 | + runs-on: ubuntu-latest |
| 38 | + strategy: |
| 39 | + matrix: |
| 40 | + profile: [dev, release] |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: Checkout code |
| 44 | + uses: actions/checkout@v4 |
| 45 | + |
| 46 | + - name: Setup Rust toolchain |
| 47 | + uses: dtolnay/rust-toolchain@stable |
| 48 | + with: |
| 49 | + toolchain: ${{ env.RUST_VERSION }} |
| 50 | + components: rustfmt, clippy |
| 51 | + |
| 52 | + - name: Cache cargo registry |
| 53 | + uses: actions/cache@v4 |
| 54 | + with: |
| 55 | + path: | |
| 56 | + ~/.cargo/registry/index/ |
| 57 | + ~/.cargo/registry/cache/ |
| 58 | + ~/.cargo/git/db/ |
| 59 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 60 | + restore-keys: | |
| 61 | + ${{ runner.os }}-cargo-registry- |
| 62 | +
|
| 63 | + - name: Cache cargo build |
| 64 | + uses: actions/cache@v4 |
| 65 | + with: |
| 66 | + path: target/ |
| 67 | + key: ${{ runner.os }}-cargo-build-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }} |
| 68 | + restore-keys: | |
| 69 | + ${{ runner.os }}-cargo-build-${{ matrix.profile }}- |
| 70 | + ${{ runner.os }}-cargo-build- |
| 71 | +
|
| 72 | + - name: Check code format |
| 73 | + run: cargo fmt --manifest-path ./mcp-servers/mcp-bash-server/Cargo.toml --check |
| 74 | + |
| 75 | + - name: Run cargo check |
| 76 | + run: | |
| 77 | + if [ "${{ matrix.profile }}" = "release" ]; then |
| 78 | + cargo check --release --manifest-path ./mcp-servers/mcp-bash-server/Cargo.toml |
| 79 | + else |
| 80 | + cargo check --manifest-path ./mcp-servers/mcp-bash-server/Cargo.toml |
| 81 | + fi |
| 82 | +
|
| 83 | + - name: Run clippy |
| 84 | + run: | |
| 85 | + if [ "${{ matrix.profile }}" = "release" ]; then |
| 86 | + cargo clippy --release --manifest-path ./mcp-servers/mcp-bash-server/Cargo.toml -- -D warnings |
| 87 | + else |
| 88 | + cargo clippy --manifest-path ./mcp-servers/mcp-bash-server/Cargo.toml -- -D warnings |
| 89 | + fi |
| 90 | +
|
| 91 | + - name: Run tests |
| 92 | + run: | |
| 93 | + if [ "${{ matrix.profile }}" = "release" ]; then |
| 94 | + cargo test --release --manifest-path ./mcp-servers/mcp-bash-server/Cargo.toml |
| 95 | + else |
| 96 | + cargo test --manifest-path ./mcp-servers/mcp-bash-server/Cargo.toml |
| 97 | + fi |
0 commit comments