|
| 1 | +on: [push, pull_request] |
| 2 | +name: Benchmark |
| 3 | +jobs: |
| 4 | + test: |
| 5 | + runs-on: ubuntu-latest |
| 6 | + services: |
| 7 | + postgres: |
| 8 | + image: postgres:10.8 |
| 9 | + env: |
| 10 | + POSTGRES_USER: postgres |
| 11 | + POSTGRES_PASSWORD: postgres |
| 12 | + POSTGRES_DB: postgres |
| 13 | + ports: |
| 14 | + - 5432:5432 |
| 15 | + # needed because the postgres container does not provide a healthcheck |
| 16 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 17 | + steps: |
| 18 | + - name: Install psql |
| 19 | + run: | |
| 20 | + sudo apt-get update |
| 21 | + sudo apt-get install -y postgresql-client |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + - uses: actions-rs/toolchain@v1 |
| 24 | + with: |
| 25 | + toolchain: stable |
| 26 | + override: true |
| 27 | + - name: Load test data |
| 28 | + run: psql -h localhost -U postgres -d postgres < tests/load-data.sql |
| 29 | + env: |
| 30 | + PGPASSWORD: "postgres" |
| 31 | + - name: Benchmark |
| 32 | + uses: actions-rs/cargo@v1 |
| 33 | + with: |
| 34 | + command: test |
| 35 | + args: --release --test benchmark -- --nocapture |
| 36 | + env: |
| 37 | + TEST_URL: "postgresql://localhost/postgres?user=postgres&password=postgres" |
0 commit comments