2020-09-16 02:11:49 +02:00
|
|
|
name: CI (Linux)
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [opened, synchronize, reopened]
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build_and_test:
|
|
|
|
name: ${{ matrix.version }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-10-07 00:12:42 +02:00
|
|
|
version: ['stable', 'nightly']
|
|
|
|
|
|
|
|
env:
|
|
|
|
# included in example of redis, not clear its purpose
|
|
|
|
CI: true
|
2020-09-16 02:11:49 +02:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: ${{ matrix.version }}
|
|
|
|
override: true
|
|
|
|
|
2021-10-07 00:12:42 +02:00
|
|
|
- name: Generate Cargo.lock
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with: { command: generate-lockfile }
|
|
|
|
- name: Cache Dependencies
|
|
|
|
uses: Swatinem/rust-cache@v1.2.0
|
|
|
|
|
2021-03-03 15:37:17 +01:00
|
|
|
- name: create test db for sqlx
|
|
|
|
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
|
|
|
|
sqlx database create
|
|
|
|
chmod a+rwx 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
|
2021-10-07 00:12:42 +02:00
|
|
|
# TODO: remove exclude protobuf-example when upgraded; currently fails on nightly
|
|
|
|
args: --workspace --bins --examples --tests --exclude protobuf-example
|
2020-09-16 02:11:49 +02:00
|
|
|
|
|
|
|
- name: start redis
|
|
|
|
uses: supercharge/redis-github-action@1.1.0
|
|
|
|
with:
|
|
|
|
redis-version: 6
|
|
|
|
|
2021-03-01 19:35:02 +01:00
|
|
|
- name: run diesel migrations
|
|
|
|
run: |
|
|
|
|
cargo install diesel_cli
|
|
|
|
cd database_interactions/diesel
|
|
|
|
diesel migration run
|
|
|
|
chmod a+rwx test.db
|
|
|
|
|
2020-09-16 02:11:49 +02:00
|
|
|
- name: cargo test
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
timeout-minutes: 30
|
|
|
|
with:
|
|
|
|
command: test
|
2021-10-07 00:12:42 +02:00
|
|
|
# TODO: remove exclude protobuf-example when upgraded; currently fails on nightly
|
|
|
|
args: --workspace --all-features --no-fail-fast --exclude protobuf-example -- --nocapture
|