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
|
|
|
|
|
|
|
env:
|
2022-12-11 16:20:19 +01:00
|
|
|
CI: 1
|
|
|
|
CARGO_UNSTABLE_SPARSE_REGISTRY: true
|
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
|
|
|
|
run: |
|
|
|
|
rustup install ${{ matrix.version }} --no-self-update --profile minimal --force
|
|
|
|
rustup override set ${{ matrix.version }}
|
2020-09-16 02:11:49 +02:00
|
|
|
|
2022-12-11 16:20:19 +01:00
|
|
|
- run: cargo generate-lockfile
|
2021-10-07 00:12:42 +02:00
|
|
|
- name: Cache Dependencies
|
2022-12-11 16:20:19 +01:00
|
|
|
uses: Swatinem/rust-cache@v2.2.0
|
2021-10-07 00:12:42 +02:00
|
|
|
|
2022-02-06 09:38:58 +01:00
|
|
|
- name: Create test DBs
|
2021-03-03 15:37:17 +01:00
|
|
|
run: |
|
|
|
|
sudo apt-get update && sudo apt-get install sqlite3
|
2022-02-06 09:19:35 +01:00
|
|
|
cargo install sqlx-cli --no-default-features --features=rustls,sqlite
|
|
|
|
cd basics/todo
|
2022-02-06 09:38:58 +01:00
|
|
|
DATABASE_URL="sqlite://./todo.db" sqlx database create
|
2022-02-06 09:19:35 +01:00
|
|
|
chmod a+rwx todo.db
|
2022-02-06 09:38:58 +01:00
|
|
|
DATABASE_URL="sqlite://./todo.db" sqlx migrate run
|
2021-03-03 15:37:17 +01:00
|
|
|
|
2020-09-16 02:11:49 +02:00
|
|
|
- name: cargo check
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
timeout-minutes: 30
|
|
|
|
with:
|
|
|
|
command: check
|
2022-07-10 04:30:48 +02:00
|
|
|
args: --workspace --bins --examples --tests
|
2020-09-16 02:11:49 +02:00
|
|
|
|
|
|
|
- name: start redis
|
|
|
|
uses: supercharge/redis-github-action@1.1.0
|
2022-12-11 16:20:19 +01:00
|
|
|
with: { redis-version: 6 }
|
2020-09-16 02:11:49 +02:00
|
|
|
|
2022-02-18 03:27:07 +01:00
|
|
|
# - name: run diesel migrations
|
|
|
|
# run: |
|
|
|
|
# cargo install diesel_cli --no-default-features --features sqlite
|
|
|
|
# cd databases/diesel
|
|
|
|
# diesel migration run
|
|
|
|
# chmod a+rwx test.db
|
2021-03-01 19:35:02 +01:00
|
|
|
|
2020-09-16 02:11:49 +02:00
|
|
|
- name: cargo test
|
2022-12-11 16:20:19 +01:00
|
|
|
run: cargo test --workspace --all-features --no-fail-fast -- --nocapture
|
2020-09-16 02:11:49 +02:00
|
|
|
timeout-minutes: 30
|