diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6738b0b..3407515 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,19 +1,46 @@ name: Rust on: - push: - branches: [ master ] pull_request: - branches: [ master ] + branches: + - master + push: + branches: + - master jobs: - build: + rust: + name: Rust project runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + + - name: Install OS deps + run: sudo apt update -y && sudo apt install -y libpq-dev + + - name: Install Rust stable + run: rustup update stable && rustup default stable + + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + + - name: Run rustfmt + run: cargo fmt --all -- --check + + - name: Run the test suite + run: cargo test --all