mirror of
https://github.com/actix/examples
synced 2024-11-27 16:02:57 +01:00
70 lines
1.8 KiB
YAML
70 lines
1.8 KiB
YAML
name: CI (Linux)
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
push:
|
|
branches: [master]
|
|
|
|
jobs:
|
|
build_and_test:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
version: [stable, nightly]
|
|
|
|
name: ${{ matrix.version }}
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
CI: 1
|
|
CARGO_UNSTABLE_SPARSE_REGISTRY: true
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install Rust
|
|
run: |
|
|
rustup install ${{ matrix.version }} --no-self-update --profile minimal --force
|
|
rustup override set ${{ matrix.version }}
|
|
|
|
- name: Cache Dependencies
|
|
uses: Swatinem/rust-cache@v2.2.0
|
|
|
|
- name: Install DB CLI tools
|
|
run: |
|
|
cargo install sqlx-cli --no-default-features --features=rustls,sqlite
|
|
cargo install diesel_cli --no-default-features --features sqlite
|
|
|
|
- name: Create Test DBs
|
|
env:
|
|
DATABASE_URL: sqlite://./todo.db
|
|
run: |
|
|
sudo apt-get update && sudo apt-get install sqlite3
|
|
cd basics/todo
|
|
sqlx database create
|
|
chmod a+rwx todo.db
|
|
sqlx migrate run
|
|
|
|
- name: cargo check
|
|
run: cargo check --workspace --bins --examples --tests
|
|
timeout-minutes: 30
|
|
|
|
- name: Start Redis
|
|
uses: supercharge/redis-github-action@1.1.0
|
|
with: { redis-version: 6 }
|
|
|
|
- name: cargo test
|
|
run: cargo test --workspace --all-features --no-fail-fast --exclude=diesel-example -- --nocapture
|
|
timeout-minutes: 30
|
|
|
|
- name: cargo test (diesel)
|
|
env:
|
|
DATABASE_URL: test.db
|
|
run: |
|
|
cd databases/diesel
|
|
diesel migration run
|
|
chmod a+rwx test.db
|
|
cargo test -p=diesel-example --no-fail-fast -- --nocapture
|
|
timeout-minutes: 10
|