mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-30 13:20:59 +00:00
Merge pull request #21 from launchbadge/rl-ci
Setup CI for Postgres and MySQL
This commit is contained in:
commit
1c9d8e0a80
55
.github/workflows/mariadb.yml
vendored
Normal file
55
.github/workflows/mariadb.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
name: MariaDB
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
mariadb: [10.1.43, 10.4.11]
|
||||
|
||||
services:
|
||||
mariadb:
|
||||
image: mariadb:${{ matrix.mariadb }}
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: sqlx
|
||||
ports:
|
||||
# will assign a random free host port
|
||||
- 3306/tcp
|
||||
# needed because the container does not provide a healthcheck
|
||||
options: --health-cmd "mysqladmin ping --silent" --health-interval 30s --health-timeout 30s --health-retries 10
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/registry
|
||||
key: ${{ runner.os }}-mysql-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Cache cargo index
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/git
|
||||
key: ${{ runner.os }}-mysql-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Cache cargo build
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: target
|
||||
key: ${{ runner.os }}-mysql-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Setup rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- run: cargo test -p sqlx --no-default-features --features 'mysql macros chrono'
|
||||
env:
|
||||
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
|
||||
55
.github/workflows/mysql.yml
vendored
Normal file
55
.github/workflows/mysql.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
name: MySQL
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
mysql: [5.7.28, 8.0.18]
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:${{ matrix.mysql }}
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: sqlx
|
||||
ports:
|
||||
# will assign a random free host port
|
||||
- 3306/tcp
|
||||
# needed because the container does not provide a healthcheck
|
||||
options: --health-cmd "mysqladmin ping --silent" --health-interval 30s --health-timeout 30s --health-retries 10
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/registry
|
||||
key: ${{ runner.os }}-mysql-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Cache cargo index
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/git
|
||||
key: ${{ runner.os }}-mysql-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Cache cargo build
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: target
|
||||
key: ${{ runner.os }}-mysql-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Setup rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- run: cargo test -p sqlx --no-default-features --features 'mysql macros chrono'
|
||||
env:
|
||||
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx
|
||||
56
.github/workflows/postgres.yml
vendored
Normal file
56
.github/workflows/postgres.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
name: Postgres
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
postgres: [9.4.25, 10.11, 12.1]
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:${{ matrix.postgres }}
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: postgres
|
||||
ports:
|
||||
# will assign a random free host port
|
||||
- 5432/tcp
|
||||
# needed because the postgres container does not provide a healthcheck
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Setup rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/registry
|
||||
key: ${{ runner.os }}-postgres-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Cache cargo index
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/git
|
||||
key: ${{ runner.os }}-postgres-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Cache cargo build
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: target
|
||||
key: ${{ runner.os }}-postgres-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- run: cargo test -p sqlx --no-default-features --features 'postgres macros uuid chrono'
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
||||
23
.github/workflows/rust.yml
vendored
23
.github/workflows/rust.yml
vendored
@ -10,11 +10,12 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Setup rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
- name: Cache rust
|
||||
id: cache_rust
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
path: ~/.rustup/toolchains
|
||||
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v1
|
||||
@ -34,11 +35,13 @@ jobs:
|
||||
path: target
|
||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Check
|
||||
run: cargo check --all-features
|
||||
- name: Setup rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
if: steps.cache_rust.outputs.cache-hit != 'true'
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Build
|
||||
run: cargo build --all-features
|
||||
- run: cargo check --all-features
|
||||
|
||||
- name: Unit Test
|
||||
run: cargo test -p sqlx-core --all-features
|
||||
- run: cargo test -p sqlx-core --all-features
|
||||
|
||||
7
.github/workflows/rustfmt.yml
vendored
7
.github/workflows/rustfmt.yml
vendored
@ -1,14 +1,13 @@
|
||||
name: Rust Format
|
||||
name: Format
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
check:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Check Format
|
||||
run: cargo fmt -- --check
|
||||
- run: cargo fmt -- --check
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user