Skip to content

Commit

Permalink
ci: add caching to test and lint jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
travipross committed Nov 24, 2024
1 parent 5247ffd commit cc6029a
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: cargo clippy --all-features --all-targets --verbose
format:
name: Format
Expand All @@ -28,19 +37,32 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install sqlx
run: cargo install sqlx-cli --no-default-features --features postgres
- name: Run migrations
run: sqlx migrate run
- name: Run tests
run: cargo test --all-features --all-targets --verbose
env:
DATABASE_URL: postgres://${{secrets.POSTGRES_USER}}:${{secrets.POSTGRES_PASSWORD}}@database:5432/${{secrets.POSTGRES_DB}}
environment: "Rust CI"
DATABASE_URL: postgres://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@database:5432/${{ secrets.POSTGRES_DB }}
services:
database:
image: postgres:16
env:
POSTGRES_PASSWORD: ${{secrets.POSTGRES_PASSWORD}}
POSTGRES_USER: ${{secrets.POSTGRES_USER}}
POSTGRES_DB: ${{secrets.POSTGRES_DB}}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

0 comments on commit cc6029a

Please # to comment.