Skip to content

CI

CI #53

Workflow file for this run

name: CI
on:
push:
branches:
- master
- staging
- trying
pull_request:
branches:
- master
jobs:
Test:
strategy:
matrix:
os: [ubuntu-latest]
rust: ["1.70", stable, beta]
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres:14-bullseye
ports:
- "5432:5432"
env:
POSTGRES_DB: shurly
POSTGRES_USER: shurly
POSTGRES_PASSWORD: verysecret
options: >-
--health-cmd "pg_isready"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Use offline SQLx
run: |
echo "SQLX_OFFLINE=true" >> $GITHUB_ENV
echo "DATABASE_URL=postgres://shurly:verysecret@localhost:5432/shurly" >> $GITHUB_ENV
- name: Build
run: cargo build
- name: Test
run: cargo test
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Format check
run: cargo fmt --all -- --check
- name: Clippy check
if: always()
run: cargo clippy --workspace --all-targets -- -D warnings
# We need some "accummulation" job here because bors fails (timeouts) to
# listen on matrix builds. Hence, we have some kind of dummy here that bors
# can listen on
Success:
name: Success
needs:
- Test
- Lint
runs-on: ubuntu-latest
steps:
- name: Success
run: exit 0