238 lines
5.4 KiB
YAML

name: tests
on:
pull_request:
push:
branches:
- master
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Unit Test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--all
--exclude 'sea-orm-example-*'
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--all
--exclude 'sea-orm-example-*'
cli:
name: CLI
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: install
args: >
--path sea-orm-cli
sqlite:
name: SQLite
runs-on: ubuntu-20.04
env:
DATABASE_URL: "sqlite::memory:"
strategy:
matrix:
runtime: [async-std-native-tls, actix-native-tls, tokio-native-tls]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--features default,runtime-${{ matrix.runtime }}
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--features default,sqlx-sqlite,runtime-${{ matrix.runtime }}
mysql:
name: MySQL
runs-on: ubuntu-20.04
env:
DATABASE_URL: "mysql://root:@localhost"
strategy:
matrix:
version: [8.0, 5.7]
runtime: [async-std-native-tls, actix-native-tls, tokio-native-tls]
services:
mysql:
image: mysql:${{ matrix.version }}
env:
MYSQL_HOST: 127.0.0.1
MYSQL_DB: mysql
MYSQL_USER: sea
MYSQL_PASSWORD: sea
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ROOT_PASSWORD:
ports:
- "3306:3306"
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--features default,runtime-${{ matrix.runtime }}
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--features default,sqlx-mysql,runtime-${{ matrix.runtime }}
mariadb:
name: MariaDB
runs-on: ubuntu-20.04
env:
DATABASE_URL: "mysql://root:@localhost"
strategy:
matrix:
version: [10.6]
runtime: [async-std-native-tls, actix-native-tls, tokio-native-tls]
services:
mysql:
image: mariadb:${{ matrix.version }}
env:
MYSQL_HOST: 127.0.0.1
MYSQL_DB: mysql
MYSQL_USER: sea
MYSQL_PASSWORD: sea
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ROOT_PASSWORD:
ports:
- "3306:3306"
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--features default,runtime-${{ matrix.runtime }}
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--features default,sqlx-mysql,runtime-${{ matrix.runtime }}
postgres:
name: Postgres
runs-on: ubuntu-20.04
env:
DATABASE_URL: "postgres://root:root@localhost"
strategy:
matrix:
version: [13.3, 12.7, 11.12, 10.17, 9.6.22]
runtime: [async-std-native-tls, actix-native-tls, tokio-native-tls]
services:
postgres:
image: postgres:${{ matrix.version }}
env:
POSTGRES_HOST: 127.0.0.1
POSTGRES_USER: root
POSTGRES_PASSWORD: root
ports:
- "5432:5432"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--features default,runtime-${{ matrix.runtime }}
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--features default,sqlx-postgres,runtime-${{ matrix.runtime }}