2020-09-16 02:11:49 +02:00
|
|
|
name: CI (Linux)
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [opened, synchronize, reopened]
|
|
|
|
push:
|
2022-12-11 16:20:19 +01:00
|
|
|
branches: [master]
|
2020-09-16 02:11:49 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build_and_test:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-08-08 00:58:56 +02:00
|
|
|
version: [stable, nightly]
|
2022-12-11 16:20:19 +01:00
|
|
|
|
2022-08-28 19:40:59 +02:00
|
|
|
name: ${{ matrix.version }}
|
|
|
|
runs-on: ubuntu-latest
|
2021-10-07 00:12:42 +02:00
|
|
|
|
2020-09-16 02:11:49 +02:00
|
|
|
steps:
|
2022-12-11 16:20:19 +01:00
|
|
|
- uses: actions/checkout@v3
|
2020-09-16 02:11:49 +02:00
|
|
|
|
2022-12-11 16:20:19 +01:00
|
|
|
- name: Install Rust
|
2023-07-09 00:02:44 +02:00
|
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1.5.0
|
2023-03-14 04:32:46 +01:00
|
|
|
with:
|
|
|
|
toolchain: ${{ matrix.version }}
|
2021-10-07 00:12:42 +02:00
|
|
|
|
2022-12-12 03:41:22 +01:00
|
|
|
- name: Install DB CLI tools
|
2021-03-03 15:37:17 +01:00
|
|
|
run: |
|
2022-02-06 09:19:35 +01:00
|
|
|
cargo install sqlx-cli --no-default-features --features=rustls,sqlite
|
2022-12-12 03:41:22 +01:00
|
|
|
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
|
|
|
|
sqlx database create
|
2023-07-09 03:08:43 +02:00
|
|
|
chmod a+rwx ./todo.db
|
2022-12-12 03:41:22 +01:00
|
|
|
sqlx migrate run
|
2021-03-03 15:37:17 +01:00
|
|
|
|
2020-09-16 02:11:49 +02:00
|
|
|
- name: cargo check
|
2022-12-12 03:41:22 +01:00
|
|
|
run: cargo check --workspace --bins --examples --tests
|
2020-09-16 02:11:49 +02:00
|
|
|
timeout-minutes: 30
|
|
|
|
|
2022-12-12 03:41:22 +01:00
|
|
|
- name: Start Redis
|
2023-04-23 22:53:40 +02:00
|
|
|
uses: supercharge/redis-github-action@1.5.0
|
2022-12-11 16:20:19 +01:00
|
|
|
with: { redis-version: 6 }
|
2020-09-16 02:11:49 +02:00
|
|
|
|
|
|
|
- name: cargo test
|
2022-12-12 03:41:22 +01:00
|
|
|
run: cargo test --workspace --all-features --no-fail-fast --exclude=diesel-example -- --nocapture
|
2020-09-16 02:11:49 +02:00
|
|
|
timeout-minutes: 30
|
2022-12-12 03:41:22 +01:00
|
|
|
|
|
|
|
- name: cargo test (diesel)
|
|
|
|
env:
|
|
|
|
DATABASE_URL: test.db
|
|
|
|
run: |
|
|
|
|
cd databases/diesel
|
|
|
|
diesel migration run
|
|
|
|
chmod a+rwx test.db
|
2023-03-14 03:33:45 +01:00
|
|
|
cargo test -p=diesel-example --no-fail-fast -- --nocapture
|
2022-12-12 03:41:22 +01:00
|
|
|
timeout-minutes: 10
|
2023-03-14 04:24:17 +01:00
|
|
|
|
|
|
|
- name: Clear the cargo caches
|
|
|
|
run: cargo install cargo-cache --version=0.8.3 --no-default-features --features=ci-autoclean && cargo-cache
|