Skip to content

Commit

Permalink
Update Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 authored and tyt2y3 committed Aug 29, 2021
1 parent 0e7c700 commit 4af7d1c
Showing 1 changed file with 74 additions and 16 deletions.
90 changes: 74 additions & 16 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ env:

jobs:

compile:
name: Compile
compile-sqlite:
name: Compile SQLite
runs-on: ubuntu-20.04
strategy:
matrix:
database: [sqlite, mysql, postgres]
runtime: [async-std, actix, tokio]
tls: [native-tls, rustls]
steps:
Expand All @@ -35,13 +34,77 @@ jobs:
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-${{ matrix.database }}-${{ matrix.runtime }}-${{ matrix.tls }}
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-sqlite-${{ matrix.runtime }}-${{ matrix.tls }}

- uses: actions-rs/cargo@v1
with:
command: test
args: >
--features default,sqlx-sqlite,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--no-run
compile-mysql:
name: Compile MySQL
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 }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}

- uses: actions-rs/cargo@v1
with:
command: test
args: >
--features default,sqlx-${{ matrix.database }},runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--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

- 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: >
--features default,sqlx-postgres,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--no-run
test:
Expand Down Expand Up @@ -89,6 +152,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
path: [async-std, tokio]
steps:
- uses: actions/checkout@v2

Expand All @@ -102,18 +166,12 @@ jobs:
with:
command: build
args: >
--manifest-path examples/async-std/Cargo.toml
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--manifest-path examples/tokio/Cargo.toml
--manifest-path examples/${{ matrix.path }}/Cargo.toml
sqlite:
name: SQLite
runs-on: ubuntu-20.04
needs: compile
needs: compile-sqlite
env:
DATABASE_URL: "sqlite::memory:"
strategy:
Expand Down Expand Up @@ -147,7 +205,7 @@ jobs:
mysql:
name: MySQL
runs-on: ubuntu-20.04
needs: compile
needs: compile-mysql
env:
DATABASE_URL: "mysql://root:@localhost"
strategy:
Expand Down Expand Up @@ -199,7 +257,7 @@ jobs:
mariadb:
name: MariaDB
runs-on: ubuntu-20.04
needs: compile
needs: compile-mysql
env:
DATABASE_URL: "mysql://root:@localhost"
strategy:
Expand Down Expand Up @@ -251,7 +309,7 @@ jobs:
postgres:
name: Postgres
runs-on: ubuntu-20.04
needs: compile
needs: compile-postgres
env:
DATABASE_URL: "postgres://root:root@localhost"
strategy:
Expand Down

0 comments on commit 4af7d1c

Please sign in to comment.