mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
test: re-initialize github workflow
This commit is contained in:
parent
9233cb5812
commit
0386d6ed6c
7 changed files with 122 additions and 731 deletions
|
@ -6,3 +6,6 @@ end_of_line = lf
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.yml]
|
||||||
|
indent_size = 2
|
||||||
|
|
191
.github/workflows/build-examples.yml
vendored
191
.github/workflows/build-examples.yml
vendored
|
@ -1,191 +0,0 @@
|
||||||
name: Build Examples
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
sqlite-todos:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Cache target/
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Install sqlite3
|
|
||||||
run: |
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -yq sqlite3
|
|
||||||
|
|
||||||
- name: Create sqlite db
|
|
||||||
working-directory: examples/sqlite/todos
|
|
||||||
run: echo ".exit" | sqlite3 todos.db -init schema.sql
|
|
||||||
|
|
||||||
- working-directory: examples/sqlite/todos
|
|
||||||
# required because the `env` key does not expand environment variables
|
|
||||||
run: DATABASE_URL=sqlite://$PWD/todos.db cargo build
|
|
||||||
|
|
||||||
postgres-listen:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
postgres: [9.4, 10, 12]
|
|
||||||
|
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres:${{ matrix.postgres }}
|
|
||||||
env:
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: postgres
|
|
||||||
ports:
|
|
||||||
- 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
|
|
||||||
|
|
||||||
# Rust ------------------------------------------------
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Cache target/
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
# build the example
|
|
||||||
- working-directory: examples/postgres/listen
|
|
||||||
run: cargo build
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
|
||||||
|
|
||||||
postgres-todos:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
postgres: [9.4, 10, 12]
|
|
||||||
|
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres:${{ matrix.postgres }}
|
|
||||||
env:
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: todos
|
|
||||||
ports:
|
|
||||||
- 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
|
|
||||||
|
|
||||||
# Rust ------------------------------------------------
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Cache target/
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
|
|
||||||
# load schema.sql
|
|
||||||
- name: Load schema
|
|
||||||
working-directory: examples/postgres/todos
|
|
||||||
run: |
|
|
||||||
export CONTAINER_ID=$(docker ps --filter "ancestor=postgres:${{ matrix.postgres }}" --format "{{.ID}}")
|
|
||||||
docker cp schema.sql $CONTAINER_ID:/schema.sql
|
|
||||||
docker exec $CONTAINER_ID bash -c "psql -d $DATABASE_URL -f ./schema.sql"
|
|
||||||
env:
|
|
||||||
# the in-container port is always 5432
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/todos
|
|
||||||
|
|
||||||
# build the example
|
|
||||||
- working-directory: examples/postgres/todos
|
|
||||||
run: cargo build
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/todos
|
|
||||||
|
|
||||||
mysql-todos:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
image: ["mysql:5.7.28", "mysql:8.0.18", "mariadb:10.1.43", "mariadb:10.4.11"]
|
|
||||||
|
|
||||||
services:
|
|
||||||
mysql:
|
|
||||||
image: ${{ matrix.image }}
|
|
||||||
env:
|
|
||||||
MYSQL_ROOT_PASSWORD: password
|
|
||||||
MYSQL_DATABASE: todos
|
|
||||||
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 -v /data/mysql:/var/lib/mysql
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
|
|
||||||
# Rust ------------------------------------------------
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Cache target/
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Load schema
|
|
||||||
working-directory: examples/mysql/todos
|
|
||||||
run: |
|
|
||||||
export CONTAINER_ID=$(docker ps --filter "ancestor=${{ matrix.image }}" --format "{{.ID}}")
|
|
||||||
docker cp schema.sql $CONTAINER_ID:/schema.sql
|
|
||||||
docker exec $CONTAINER_ID bash -c "mysql -uroot -ppassword todos < /schema.sql"
|
|
||||||
|
|
||||||
- working-directory: examples/mysql/todos
|
|
||||||
run: cargo build
|
|
||||||
env:
|
|
||||||
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/todos
|
|
||||||
|
|
111
.github/workflows/realworld.yml
vendored
111
.github/workflows/realworld.yml
vendored
|
@ -1,111 +0,0 @@
|
||||||
name: Build realworld
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
postgres:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
postgres: [9.6, 10, 12]
|
|
||||||
|
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres:${{ matrix.postgres }}
|
|
||||||
env:
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: realworld
|
|
||||||
ports:
|
|
||||||
- 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
|
|
||||||
|
|
||||||
# Rust ------------------------------------------------
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Cache target/
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
|
|
||||||
- name: Load schema
|
|
||||||
working-directory: examples/realworld
|
|
||||||
run: |
|
|
||||||
export CONTAINER_ID=$(docker ps --filter "ancestor=postgres:${{ matrix.postgres }}" --format "{{.ID}}")
|
|
||||||
docker cp schema/postgres.sql $CONTAINER_ID:/schema.sql
|
|
||||||
docker exec $CONTAINER_ID bash -c "psql -d $DATABASE_URL -f ./schema.sql"
|
|
||||||
env:
|
|
||||||
# the in-container port is always 5432
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/realworld
|
|
||||||
|
|
||||||
- name: cargo build
|
|
||||||
run: cargo build --features postgres
|
|
||||||
working-directory: examples/realworld
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/realworld
|
|
||||||
|
|
||||||
- name: run API integration tests
|
|
||||||
working-directory: examples/realworld
|
|
||||||
run: |
|
|
||||||
cargo run --features postgres -- --db postgres &
|
|
||||||
sleep 5;
|
|
||||||
npx newman@latest run https://raw.githubusercontent.com/gothinkster/realworld/master/api/Conduit.postman_collection.json \
|
|
||||||
--global-var "APIURL=http://localhost:8080/api" \
|
|
||||||
--global-var "USERNAME=sqlx_`date +%s`" \
|
|
||||||
--global-var "EMAIL=sqlx_`date +%s`@not.a.real.email" \
|
|
||||||
--global-var "PASSWORD=insecure"
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/realworld
|
|
||||||
|
|
||||||
sqlite:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Cache target/
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Install sqlite3
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y sqlite3
|
|
||||||
|
|
||||||
- name: Initialize db
|
|
||||||
working-directory: examples/realworld
|
|
||||||
run: |
|
|
||||||
sqlite3 realworld.db < schema/sqlite.sql
|
|
||||||
|
|
||||||
- name: cargo build
|
|
||||||
run: DATABASE_URL=sqlite://${PWD}/realworld.db cargo build --features sqlite
|
|
||||||
working-directory: examples/realworld
|
|
||||||
|
|
||||||
# TODO: run integration tests once #193 is resolved
|
|
342
.github/workflows/rust.yml
vendored
342
.github/workflows/rust.yml
vendored
|
@ -1,342 +0,0 @@
|
||||||
name: Rust
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
format:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
|
|
||||||
- run: cargo fmt --all -- --check
|
|
||||||
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
|
|
||||||
# Rust ------------------------------------------------
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Cache target/
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
|
|
||||||
# check w/deny warnings in sqlx-core: async-std
|
|
||||||
- working-directory: sqlx-core
|
|
||||||
run: cargo rustc --no-default-features --features 'all-types postgres mysql tls runtime-async-std' -- -D warnings --emit=metadata
|
|
||||||
|
|
||||||
# check w/deny warnings in sqlx-core: tokio
|
|
||||||
# `cargo rustc -p sqlx-core` ignores `--no-default-features` and builds with `runtime-async-std` anyway
|
|
||||||
# https://github.com/rust-lang/cargo/issues/5364
|
|
||||||
- working-directory: sqlx-core
|
|
||||||
run: cargo rustc --no-default-features --features 'all-types postgres mysql tls runtime-tokio' -- -D warnings --emit=metadata
|
|
||||||
|
|
||||||
# check w/deny warnings: async-std
|
|
||||||
- run: cargo rustc --no-default-features --features 'all-types postgres mysql macros tls runtime-async-std' -- -D warnings --emit=metadata
|
|
||||||
|
|
||||||
# check w/deny warnings: tokio
|
|
||||||
- run: cargo rustc --no-default-features --features 'all-types postgres mysql macros tls runtime-tokio' -- -D warnings --emit=metadata
|
|
||||||
|
|
||||||
# unit test: async-std
|
|
||||||
- run: cargo test --manifest-path sqlx-core/Cargo.toml --no-default-features --features 'all-types postgres mysql tls runtime-async-std'
|
|
||||||
|
|
||||||
# unit test: tokio
|
|
||||||
- run: cargo test --manifest-path sqlx-core/Cargo.toml --no-default-features --features 'all-types postgres mysql tls runtime-tokio'
|
|
||||||
|
|
||||||
# integration test: sqlite + async-std
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-async-std sqlite macros tls'
|
|
||||||
env:
|
|
||||||
# note: absolute path required for UI tests
|
|
||||||
# https://github.com/dtolnay/trybuild/issues/69#issuecomment-620329526
|
|
||||||
DATABASE_URL: ${{ format('sqlite://{0}/tests/fixtures/sqlite.sqlite', github.workspace) }}
|
|
||||||
|
|
||||||
# integration test: sqlite + tokio
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-tokio sqlite macros tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: ${{ format('sqlite://{0}/tests/fixtures/sqlite.sqlite', github.workspace) }}
|
|
||||||
|
|
||||||
# Rust ------------------------------------------------
|
|
||||||
|
|
||||||
- name: Prepare build directory for cache
|
|
||||||
run: |
|
|
||||||
find ./target/debug -maxdepth 1 -type f -delete \
|
|
||||||
&& rm -fr ./target/debug/{deps,.fingerprint}/*sqlx* \
|
|
||||||
&& rm -f ./target/.rustc_info.json
|
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
|
|
||||||
postgres:
|
|
||||||
needs: build
|
|
||||||
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
|
|
||||||
|
|
||||||
# Rust ------------------------------------------------
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Cache target/
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
|
|
||||||
# integration test: async-std (chrono)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-async-std postgres macros uuid chrono bigdecimal json ipnetwork tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
|
||||||
|
|
||||||
# integration test: async-std (time)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-async-std postgres macros uuid time bigdecimal json ipnetwork tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
|
||||||
|
|
||||||
# integration test: async-std (time + chrono)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-async-std postgres macros uuid chrono time bigdecimal json ipnetwork tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
|
||||||
|
|
||||||
# integration test: tokio (chrono)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-tokio postgres macros uuid chrono bigdecimal json ipnetwork tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
|
||||||
|
|
||||||
# integration test: tokio (time)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-tokio postgres macros uuid time bigdecimal json ipnetwork tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
|
||||||
|
|
||||||
# integration test: tokio (time + chrono)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-tokio postgres macros uuid chrono time bigdecimal json ipnetwork tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
|
||||||
|
|
||||||
# UI feature gate tests: async-std
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-async-std postgres macros bigdecimal json ipnetwork tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
|
||||||
|
|
||||||
# UI feature gate tests: tokio
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-tokio postgres macros bigdecimal json ipnetwork tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
|
||||||
|
|
||||||
mysql:
|
|
||||||
needs: build
|
|
||||||
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 -v /data/mysql:/var/lib/mysql
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
|
|
||||||
# Rust ------------------------------------------------
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Cache target/
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
|
|
||||||
# integration test: async-std (chrono)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-async-std mysql macros uuid chrono tls bigdecimal'
|
|
||||||
env:
|
|
||||||
# pass the path to the CA that the MySQL service generated
|
|
||||||
# NOTE: Github Actions' YML parser doesn't handle multiline strings correctly
|
|
||||||
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx?ssl-mode=VERIFY_CA&ssl-ca=%2Fdata%2Fmysql%2Fca.pem
|
|
||||||
|
|
||||||
# integration test: async-std (time)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-async-std mysql macros uuid time tls bigdecimal'
|
|
||||||
env:
|
|
||||||
# pass the path to the CA that the MySQL service generated
|
|
||||||
# NOTE: Github Actions' YML parser doesn't handle multiline strings correctly
|
|
||||||
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx?ssl-mode=VERIFY_CA&ssl-ca=%2Fdata%2Fmysql%2Fca.pem
|
|
||||||
|
|
||||||
# integration test: async-std (time + chrono)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-async-std mysql macros uuid time chrono tls bigdecimal'
|
|
||||||
env:
|
|
||||||
# pass the path to the CA that the MySQL service generated
|
|
||||||
# NOTE: Github Actions' YML parser doesn't handle multiline strings correctly
|
|
||||||
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx?ssl-mode=VERIFY_CA&ssl-ca=%2Fdata%2Fmysql%2Fca.pem
|
|
||||||
|
|
||||||
# integration test: tokio (chrono)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-tokio mysql macros uuid chrono tls bigdecimal'
|
|
||||||
env:
|
|
||||||
# pass the path to the CA that the MySQL service generated
|
|
||||||
# NOTE: Github Actions' YML parser doesn't handle multiline strings correctly
|
|
||||||
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx?ssl-mode=VERIFY_CA&ssl-ca=%2Fdata%2Fmysql%2Fca.pem
|
|
||||||
|
|
||||||
# integration test: tokio (time)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-tokio mysql macros uuid time tls bigdecimal'
|
|
||||||
env:
|
|
||||||
# pass the path to the CA that the MySQL service generated
|
|
||||||
# NOTE: Github Actions' YML parser doesn't handle multiline strings correctly
|
|
||||||
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx?ssl-mode=VERIFY_CA&ssl-ca=%2Fdata%2Fmysql%2Fca.pem
|
|
||||||
|
|
||||||
# integration test: tokio (time + chrono)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-tokio mysql macros uuid chrono time tls bigdecimal'
|
|
||||||
env:
|
|
||||||
# pass the path to the CA that the MySQL service generated
|
|
||||||
# NOTE: Github Actions' YML parser doesn't handle multiline strings correctly
|
|
||||||
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx?ssl-mode=VERIFY_CA&ssl-ca=%2Fdata%2Fmysql%2Fca.pem
|
|
||||||
|
|
||||||
# UI feature gate tests: async-std
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-async-std mysql macros tls bigdecimal' --test ui-tests
|
|
||||||
env:
|
|
||||||
# pass the path to the CA that the MySQL service generated
|
|
||||||
# NOTE: Github Actions' YML parser doesn't handle multiline strings correctly
|
|
||||||
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx?ssl-mode=VERIFY_CA&ssl-ca=%2Fdata%2Fmysql%2Fca.pem
|
|
||||||
|
|
||||||
# UI feature gate tests: tokio
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-tokio mysql macros tls bigdecimal' --test ui-tests
|
|
||||||
env:
|
|
||||||
# pass the path to the CA that the MySQL service generated
|
|
||||||
# NOTE: Github Actions' YML parser doesn't handle multiline strings correctly
|
|
||||||
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx?ssl-mode=VERIFY_CA&ssl-ca=%2Fdata%2Fmysql%2Fca.pem
|
|
||||||
|
|
||||||
|
|
||||||
mariadb:
|
|
||||||
needs: build
|
|
||||||
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
|
|
||||||
|
|
||||||
# Rust ------------------------------------------------
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Cache target/
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
|
|
||||||
# integration test: async-std (chrono)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-async-std mysql macros chrono uuid chrono tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
|
|
||||||
|
|
||||||
# integration test: async-std (time)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-async-std mysql macros time uuid chrono tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
|
|
||||||
|
|
||||||
# integration test: async-std (time + chrono)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-async-std mysql macros time chrono uuid chrono tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
|
|
||||||
|
|
||||||
# integration test: tokio (chrono)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-tokio mysql macros uuid chrono tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
|
|
||||||
|
|
||||||
# integration test: tokio (time)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-tokio mysql macros uuid time tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
|
|
||||||
|
|
||||||
# integration test: tokio (time + chrono)
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-tokio mysql macros uuid time chrono tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
|
|
||||||
|
|
||||||
# UI feature gate tests: async-std
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-async-std mysql macros tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
|
|
||||||
|
|
||||||
# UI feature gate tests: tokio
|
|
||||||
- run: cargo test --no-default-features --features 'runtime-tokio mysql macros tls'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
|
|
85
.github/workflows/sqlx-cli.yml
vendored
85
.github/workflows/sqlx-cli.yml
vendored
|
@ -1,85 +0,0 @@
|
||||||
name: sqlx-cli
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# tests `cargo sqlx prepare` using `examples/postgres/todos/`
|
|
||||||
test-prepare:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres:12
|
|
||||||
env:
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: todos
|
|
||||||
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
|
|
||||||
|
|
||||||
# Rust ------------------------------------------------
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Cache target/
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Load schema
|
|
||||||
working-directory: examples/postgres/todos
|
|
||||||
env:
|
|
||||||
# the in-container port is always 5432
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/todos
|
|
||||||
run: |
|
|
||||||
export CONTAINER_ID=$(docker ps --filter "ancestor=postgres:12" --format "{{.ID}}")
|
|
||||||
docker cp schema.sql $CONTAINER_ID:/schema.sql
|
|
||||||
docker exec $CONTAINER_ID bash -c "psql -d $DATABASE_URL -f ./schema.sql"
|
|
||||||
|
|
||||||
- name: install sqlx-cli
|
|
||||||
run: cargo install -f --path sqlx-cli/
|
|
||||||
|
|
||||||
- name: test `cargo sqlx prepare [--check]`
|
|
||||||
working-directory: examples/postgres/todos/
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/todos
|
|
||||||
run: |
|
|
||||||
cargo sqlx prepare &&
|
|
||||||
cargo sqlx prepare --check
|
|
||||||
|
|
||||||
# now we have no connection to the database, we should be able to still build
|
|
||||||
- name: build example without DB
|
|
||||||
working-directory: examples/postgres/todos/
|
|
||||||
run: |
|
|
||||||
cargo clean -p sqlx-example-postgres-todos &&
|
|
||||||
cargo build
|
|
||||||
|
|
||||||
# check that the application works without rebuilding it
|
|
||||||
- name: run example
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/todos
|
|
||||||
run: |
|
|
||||||
./target/debug/sqlx-example-postgres-todos add "test if `cargo sqlx prepare` worked" &&
|
|
||||||
./target/debug/sqlx-example-postgres-todos done 1
|
|
||||||
|
|
||||||
- name: Prepare build directory for cache
|
|
||||||
run: |
|
|
||||||
find ./target/debug -maxdepth 1 -type f -delete \
|
|
||||||
&& rm -fr ./target/debug/{deps,.fingerprint}/*sqlx* \
|
|
||||||
&& rm -f ./target/.rustc_info.json
|
|
117
.github/workflows/sqlx.yml
vendored
Normal file
117
.github/workflows/sqlx.yml
vendored
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
name: SQLx
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
format:
|
||||||
|
name: Format
|
||||||
|
runs-on: ubuntu:latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
|
||||||
|
# this is cheaper than requesting the non-minimal profile
|
||||||
|
- run: rustup component add rustfmt
|
||||||
|
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: fmt
|
||||||
|
args: --all -- --check
|
||||||
|
|
||||||
|
check:
|
||||||
|
name: Check
|
||||||
|
runs-on: ubuntu:latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
|
||||||
|
# check > sqlx-core > default set of features
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: check
|
||||||
|
args: >
|
||||||
|
--manifest-path sqlx-core/Cargo.toml
|
||||||
|
|
||||||
|
# check > sqlx-core > async-std
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: check
|
||||||
|
args: >
|
||||||
|
--manifest-path sqlx-core/Cargo.toml
|
||||||
|
--no-default-features
|
||||||
|
--features offline,all-databases,all-types,runtime-async-std
|
||||||
|
|
||||||
|
# check > sqlx-core > tokio
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: check
|
||||||
|
args: >
|
||||||
|
--manifest-path sqlx-core/Cargo.toml
|
||||||
|
--no-default-features
|
||||||
|
--features offline,all-databases,all-types,runtime-tokio
|
||||||
|
|
||||||
|
# check > sqlx-core > actix
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: check
|
||||||
|
args: >
|
||||||
|
--manifest-path sqlx-core/Cargo.toml
|
||||||
|
--no-default-features
|
||||||
|
--features offline,all-databases,all-types,runtime-actix
|
||||||
|
|
||||||
|
# check > sqlx > async-std
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: check
|
||||||
|
args: >
|
||||||
|
--no-default-features
|
||||||
|
--features offline,all-databases,all-types,runtime-async-std,macros
|
||||||
|
|
||||||
|
# check > sqlx > tokio
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: check
|
||||||
|
args: >
|
||||||
|
--no-default-features
|
||||||
|
--features offline,all-databases,all-types,runtime-tokio,macros
|
||||||
|
|
||||||
|
# check > sqlx > actix
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: check
|
||||||
|
args: >
|
||||||
|
--no-default-features
|
||||||
|
--features offline,all-databases,all-types,runtime-actix,macros
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Unit Test
|
||||||
|
runs-on: ubuntu:latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: >
|
||||||
|
--manifest-path sqlx-core/Cargo.toml
|
||||||
|
--features offline,all-databases,all-types
|
|
@ -44,11 +44,11 @@ macros = [ "sqlx-macros" ]
|
||||||
tls = [ ]
|
tls = [ ]
|
||||||
|
|
||||||
# offline building support in `sqlx-macros`
|
# offline building support in `sqlx-macros`
|
||||||
offline = ["sqlx-macros/offline", "sqlx-core/offline"]
|
offline = [ "sqlx-macros/offline", "sqlx-core/offline" ]
|
||||||
|
|
||||||
# intended mainly for CI and docs
|
# intended mainly for CI and docs
|
||||||
all = [ "tls", "all-databases", "all-types" ]
|
all = [ "tls", "all-databases", "all-types" ]
|
||||||
all-databases = [ "mysql", "sqlite", "postgres" ]
|
all-databases = [ "mysql", "sqlite", "postgres", "mssql" ]
|
||||||
all-types = [ "bigdecimal", "json", "time", "chrono", "ipnetwork", "uuid" ]
|
all-types = [ "bigdecimal", "json", "time", "chrono", "ipnetwork", "uuid" ]
|
||||||
|
|
||||||
# runtime
|
# runtime
|
||||||
|
|
Loading…
Reference in a new issue