name: Rust Build on: push: branches: - main - master pull_request: env: CARGO_TERM_COLOR: always jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: https://gitea.com/actions/checkout@v4 - name: Get Cargo lock hash id: hash run: | echo "hash=$(cat Cargo.lock Cargo.toml | sha256sum | cut -d' ' -f1)" >> $GITHUB_OUTPUT - name: Cache cargo + rustup id: cache uses: https://gitea.com/actions/cache@v3 with: path: | ~/.cargo/registry ~/.cargo/git ~/.rustup/toolchains ~/.rustup/settings.toml target key: rust-Linux-${{ steps.hash.outputs.hash }} restore-keys: rust-Linux- - name: Setup Rust if: steps.cache.outputs.cache-hit != 'true' run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable - name: Build run: cargo build --verbose - name: Run run: cargo run