🎨 Palette: [UX improvement] Add colors and emojis to NumberGuess CLI #85
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Rust | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check for Rust projects | |
| id: check_rust | |
| run: | | |
| if [ -f "Cargo.toml" ] && ([ -f "src/main.rs" ] || [ -f "src/lib.rs" ]); then | |
| echo "has_rust=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_rust=false" >> $GITHUB_OUTPUT | |
| echo "No valid Rust project (Cargo.toml + src/main.rs or src/lib.rs) found. Rust steps will be skipped." | |
| echo "### 🦀 Rust Build Skip" >> $GITHUB_STEP_SUMMARY | |
| echo "No valid Rust project found in the root directory. Rust build and test steps were skipped to prevent CI failure (Exit Code 101)." >> $GITHUB_STEP_SUMMARY | |
| fi | |
| - name: Build | |
| if: steps.check_rust.outputs.has_rust == 'true' | |
| run: cargo build --verbose | |
| - name: Run tests | |
| if: steps.check_rust.outputs.has_rust == 'true' | |
| run: cargo test --verbose |