name: Rust
on:
push:
branches: ["main","stable"]
pull_request:
branches: ["main", "stable"]
env:
CARGO_TERM_COLOR: always
jobs:
format:
name: Formatting
runs-on: ubuntu-latest
steps:
- id: checkout
name: Checkout Repository
uses: actions/checkout@v4
- id: setup
name: Setup Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
- id: format
name: Run Formatting-Checks
run: cargo fmt --check
unit:
name: Units
runs-on: ubuntu-latest
strategy:
matrix:
toolchain: [stable]
steps:
- id: checkout
name: Checkout Repository
uses: actions/checkout@v4
- id: setup
name: Setup Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
components: llvm-tools-preview
- id: tools
name: Install Tools
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov, cargo-nextest
- id: install-dependency
name: Install Additional Dependency
run: |
export PATH="$HOME/.cargo/bin:$PATH"
# Clone the GitHub repository for the dependency
git clone https://github.com/Dj-Codeman/dusa.git
cd dusa
# Run the equivalent commands for building the application
cargo build --release
# Remove old versions if they exist
sudo rm -v /usr/bin/dusa || true
sudo rm -v /usr/bin/dusad || true
# Move the newly built binaries to /usr/bin
sudo mv -v ./target/release/server /usr/bin/dusad
sudo mv -v ./target/release/client /usr/bin/dusa
# Set executable permissions on the binaries
sudo chmod +x -v /usr/bin/dusad /usr/bin/dusa
# Set additional permissions using setcap
sudo setcap cap_chown=ep /usr/bin/dusa
sudo setcap cap_chown=ep /usr/bin/dusad
# Run the make command to build and install the application
sudo make user_creation
sudo make register
sudo systemctl start dusad
- id: pretty-test
name: Run cargo pretty-test
run: |
cargo install cargo-pretty-test
RUST_BACKTRACE=1 cargo pretty-test --color=always
echo '```text' >> $GITHUB_STEP_SUMMARY
echo "$(cargo pretty-test --color=never)" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY