Skip to content

Commit

Permalink
Rearranged files, added fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelOnFira committed Oct 21, 2021
1 parent 43509af commit 88a0c1f
Show file tree
Hide file tree
Showing 7 changed files with 379 additions and 314 deletions.
307 changes: 13 additions & 294 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: tests
name: rust-ci

on:
pull_request:
Expand All @@ -11,123 +11,31 @@ env:
CARGO_TERM_COLOR: always

jobs:

clippy:
name: Clippy
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
override: true

- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all

compile-sqlite:
name: Compile SQLite
runs-on: ubuntu-20.04
strategy:
matrix:
runtime: [async-std, actix, tokio]
tls: [native-tls, rustls]
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-sqlite-${{ matrix.runtime }}-${{ matrix.tls }}

- uses: actions-rs/cargo@v1
with:
command: test
args: >
--test '*'
--features default,sqlx-sqlite,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--no-run
compile-mysql:
name: Compile MySQL
clippy-fmt:
name: Clippy + Fmt
runs-on: ubuntu-20.04
strategy:
matrix:
runtime: [async-std, actix, tokio]
tls: [native-tls, rustls]
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy, rustfmt
override: true

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}

# Make sure files are formatted
- uses: actions-rs/cargo@v1
with:
command: test
command: fmt
args: >
--test '*'
--features default,sqlx-mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--no-run
compile-postgres:
name: Compile PostgreSQL
runs-on: ubuntu-20.04
strategy:
matrix:
runtime: [async-std, actix, tokio]
tls: [native-tls, rustls]
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
--all
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-postgres-${{ matrix.runtime }}-${{ matrix.tls }}

- uses: actions-rs/cargo@v1
# Run clippy
- uses: actions-rs/clippy-check@v1
with:
command: test
args: >
--test '*'
--features default,sqlx-postgres,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--no-run
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all

test:
name: Unit Test
Expand All @@ -147,12 +55,14 @@ jobs:
args: >
--workspace
# Run tests for Rocket
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--manifest-path sea-orm-rocket/Cargo.toml
# Run tests for the CLI
- uses: actions-rs/cargo@v1
with:
command: test
Expand Down Expand Up @@ -223,194 +133,3 @@ jobs:
command: build
args: >
--manifest-path issues/${{ matrix.path }}/Cargo.toml
sqlite:
name: SQLite
runs-on: ubuntu-20.04
needs: compile-sqlite
env:
DATABASE_URL: "sqlite::memory:"
strategy:
matrix:
runtime: [async-std, actix, tokio]
tls: [native-tls, rustls]
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-sqlite-${{ matrix.runtime }}-${{ matrix.tls }}

- uses: actions-rs/cargo@v1
with:
command: test
args: >
--test '*'
--features default,sqlx-sqlite,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
mysql:
name: MySQL
runs-on: ubuntu-20.04
needs: compile-mysql
env:
DATABASE_URL: "mysql://root:@localhost"
strategy:
matrix:
version: [8.0, 5.7]
runtime: [async-std, actix, tokio]
tls: [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: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}

- uses: actions-rs/cargo@v1
with:
command: test
args: >
--test '*'
--features default,sqlx-mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
mariadb:
name: MariaDB
runs-on: ubuntu-20.04
needs: compile-mysql
env:
DATABASE_URL: "mysql://root:@localhost"
strategy:
matrix:
version: [10.6]
runtime: [async-std, actix, tokio]
tls: [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: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}

- uses: actions-rs/cargo@v1
with:
command: test
args: >
--test '*'
--features default,sqlx-mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
postgres:
name: Postgres
runs-on: ubuntu-20.04
needs: compile-postgres
env:
DATABASE_URL: "postgres://root:root@localhost"
strategy:
matrix:
version: [13.3, 12.7, 11.12, 10.17, 9.6.22]
runtime: [tokio]
tls: [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: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-postgres-${{ matrix.runtime }}-${{ matrix.tls }}

- uses: actions-rs/cargo@v1
with:
command: test
args: >
--test '*'
--features default,sqlx-postgres,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
Loading

0 comments on commit 88a0c1f

Please sign in to comment.