From fb909d9b31aac2f9dc6e20c7b20699e857cbe35b Mon Sep 17 00:00:00 2001 From: Allan Jorge Date: Fri, 20 Mar 2020 21:06:57 -0300 Subject: [PATCH] update github actions --- .github/workflows/rust.yml | 43 +++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 8 deletions(-) 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