Switch Toasty to use proc macros for schema declaration #179
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cargo Build & Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: -D warnings | |
jobs: | |
check: | |
name: cargo check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- name: cargo check | |
run: cargo check --workspace --all-features | |
- name: cargo fmt | |
run: cargo fmt --all --check | |
clippy: | |
name: cargo clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- name: cargo clippy | |
run: cargo clippy --workspace --all-features | |
test-all-databases: | |
needs: check | |
name: Run tests with all databases | |
runs-on: ubuntu-latest | |
env: | |
AWS_ENDPOINT_URL_DYNAMODB: http://localhost:8000 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- name: Start dynamodb-local | |
run: sudo docker run --name dynamodb -d -p 8000:8000 amazon/dynamodb-local:latest -jar DynamoDBLocal.jar -port 8000 | |
- name: cargo test | |
run: cargo test --workspace --all-features | |
test-postgresql: | |
needs: check | |
name: Run tests for PostgreSQL | |
runs-on: ubuntu-latest | |
services: | |
postgresql: | |
image: postgres:17 | |
env: | |
POSTGRES_USER: toasty | |
POSTGRES_PASSWORD: toasty | |
POSTGRES_DB: toasty | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
env: | |
DATABASE_URL: postgres://toasty:toasty@localhost/toasty | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- name: cargo test | |
run: cargo run --bin example-hello-toasty --features postgresql | |
test-all-os: | |
needs: check | |
name: Run tests on all operating systems | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- windows-latest | |
- ubuntu-latest | |
- macos-latest | |
env: | |
AWS_ENDPOINT_URL_DYNAMODB: http://localhost:8000 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- name: cargo test | |
run: cargo test --workspace | |
- name: Run examples | |
run: scripts/gen-examples run | |
examples: | |
needs: check | |
name: Build the `hello-toasty` example with each feature | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- run: cargo install cargo-hack | |
- run: cd examples/hello-toasty && cargo hack build --each-feature |