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

76 lines
1.8 KiB
YAML

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:
version: ["stable", "nightly"]
steps:
- uses: actions/checkout@v2
- name: cache cargo artifacts
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
./target/debug
key: cargo-linux-${{ matrix.version }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-linux-${{ matrix.version }}-
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.version }}
override: true
- name: create test db for sqlx
run: |
sudo apt-get update && sudo apt-get install sqlite3
cd database_interactions/sqlx_todo
cp .env.example .env
cat schema.sql | sqlite3 test.db
chmod a+rwx test.db
- name: cargo check
uses: actions-rs/cargo@v1
timeout-minutes: 30
with:
command: check
args: --workspace --bins --examples --tests
- name: start redis
uses: supercharge/redis-github-action@1.1.0
with:
redis-version: 6
- name: run diesel migrations
run: |
cargo install diesel_cli
cd database_interactions/diesel
diesel migration run
chmod a+rwx test.db
- name: cargo test
uses: actions-rs/cargo@v1
timeout-minutes: 30
env:
# included in example of redis, not clear its purpose
CI: true
with:
command: test
args: --workspace --all-features --no-fail-fast -- --nocapture