Skip to content

Enhance Rust CI workflow with caching and checks #1

Enhance Rust CI workflow with caching and checks

Enhance Rust CI workflow with caching and checks #1

Workflow file for this run

name: Rust CI & Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Pozwala uruchomić ręcznie z zakładki Actions
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build-and-test:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Testujemy na Windows (Twoje środowisko) i Ubuntu (dla pewności)
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
# Cache przyspiesza budowanie przy kolejnych uruchomieniach
- name: Cache Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# 1. Sprawdzanie formatowania (czy użyłeś cargo fmt)
- name: Check Formatting
run: cargo fmt -- --check
# 2. Sprawdzanie jakości kodu (Linter Clippy)
- name: Lint with Clippy
run: cargo clippy -- -D warnings
# 3. Uruchomienie testów
- name: Run tests
run: cargo test --verbose
# 4. Budowanie wersji produkcyjnej (Release)
- name: Build Release
run: cargo build --release --verbose
# 5. Wyciągnięcie gotowego pliku .exe (Tylko dla Windows)
- name: Upload Windows Artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: cargo-plot-fs-tree-windows
path: target/release/cargo-plot-fs-tree.exe
# 6. Wyciągnięcie gotowego pliku binarnego (Tylko dla Linux)
- name: Upload Linux Artifact
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: cargo-plot-fs-tree-linux
path: target/release/cargo-plot-fs-tree