1
0
mirror of https://github.com/actix/examples synced 2024-12-02 18:02:22 +01:00
examples/.github/workflows/linux.yml

71 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
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-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 --all-features --no-fail-fast -- --nocapture
timeout-minutes: 10