1
0
mirror of https://github.com/actix/examples synced 2024-12-05 03:01:55 +01:00
examples/.github/workflows/ci.yml

73 lines
1.9 KiB
YAML
Raw Normal View History

2023-12-26 04:54:28 +01:00
name: CI
2020-09-16 02:11:49 +02:00
on:
pull_request:
types: [opened, synchronize, reopened]
2023-12-25 22:13:28 +01:00
merge_group:
types: [checks_requested]
2020-09-16 02:11:49 +02:00
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:
2023-12-26 04:54:28 +01:00
version: [stable]
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:
- uses: actions/checkout@v4
2020-09-16 02:11:49 +02:00
2023-10-29 03:32:37 +01:00
- name: Install Rust (${{ matrix.version }})
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
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
2023-07-09 03:22:08 +02:00
sqlx migrate run --source=./basics/todo/migrations
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
uses: supercharge/redis-github-action@1.8.0
2023-10-29 03:32:37 +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
2023-12-26 04:48:23 +01:00
- name: Install cargo-ci-cache-clean
uses: taiki-e/install-action@v2.29.7
2023-12-26 04:48:23 +01:00
with:
tool: cargo-ci-cache-clean
- name: CI cache clean
run: cargo-ci-cache-clean