1
0
mirror of https://github.com/actix/examples synced 2024-11-27 16:02:57 +01:00
examples/.github/workflows/linux.yml

70 lines
1.8 KiB
YAML
Raw Normal View History

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:
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
2023-03-14 04:24:17 +01:00
CARGO_INCREMENTAL: false
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
uses: actions-rust-lang/setup-rust-toolchain@v1.4.3
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
2022-02-06 09:19:35 +01:00
cd basics/todo
2022-12-12 03:41:22 +01:00
sqlx database create
2022-02-06 09:19:35 +01: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
2020-09-16 02:11:49 +02:00
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
- 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
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