1
0
mirror of https://github.com/actix/examples synced 2024-12-18 08:23:10 +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.10.1
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
2024-07-20 01:26:52 +02:00
run: cargo test --workspace --all-features --no-fail-fast --exclude=db-diesel -- --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
2024-07-20 01:26:52 +02:00
cargo test -p=db-diesel --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.44.35
2023-12-26 04:48:23 +01:00
with:
tool: cargo-ci-cache-clean
- name: CI cache clean
run: cargo-ci-cache-clean