Update drone pipeline
enable postgres DB on drone pipeline for further tests
This commit is contained in:
parent
6db0a7bc86
commit
7d7e7dc2d5
31
.drone.yml
31
.drone.yml
@ -8,9 +8,34 @@ trigger:
|
||||
event:
|
||||
- push
|
||||
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_DB: newsletter
|
||||
DATABASE_URL: postgres://postgres:password@postgres:5432/newsletter
|
||||
|
||||
steps:
|
||||
- name: testBuild
|
||||
- name: postgresDBTest # Test that the service is ready to be acted upon for cargo tests
|
||||
image: postgres:12-alpine
|
||||
commands:
|
||||
- sleep 15
|
||||
- psql -U ${POSTGRES_USER} -d ${POSTGRES_DB}
|
||||
|
||||
- name: sqlxMigrate
|
||||
image: rust:1.56
|
||||
commands:
|
||||
- cargo build --verbose --all
|
||||
- cargo test --verbose --all
|
||||
- apt update && apt install -y build-essential pkg-config libssl-dev # Dependancies for sqlx
|
||||
- cargo install --version=0.5.7 sqlx-cli --no-default-features --features postgres # Install sqlx
|
||||
- sqlx database create
|
||||
- sqlx migrate run
|
||||
|
||||
- name: test
|
||||
image: rust:1.56
|
||||
commands:
|
||||
- apt update && apt install -y build-essential pkg-config libssl-dev # Dependancies for tarpaulin
|
||||
- cargo install cargo-tarpaulin
|
||||
- cargo tarpaulin -v --all-features --timeout 120 --color always # RUN THOSE TESTS
|
||||
|
||||
services:
|
||||
- name: postgres
|
||||
image: postgres:12-alpine
|
@ -13,7 +13,7 @@ fi
|
||||
if ! [ -x "$(command -v sqlx)" ]; then
|
||||
echo >&2 "Error: `sqlx` is not installed."
|
||||
echo >&2 "Use:"
|
||||
echo >&2 " sudo apt install build-essential pkg-config openssl libssl-dev"
|
||||
echo >&2 " sudo apt install build-essential pkg-config libssl-dev"
|
||||
echo >&2 " cargo install --version=0.5.7 sqlx-cli --no-default-features --features postgres"
|
||||
echo >&2 "to install it."
|
||||
exit 1
|
||||
@ -43,7 +43,7 @@ until psql -h "localhost" -U "${DB_USER}" -p "${DB_PORT}" -d "postgres" -c '\q';
|
||||
sleep 1
|
||||
done
|
||||
|
||||
>&2 echo "Postgres is up anad running on port ${DB_PORT} - running migrations."
|
||||
>&2 echo "Postgres is up and running on port ${DB_PORT} - running migrations."
|
||||
|
||||
export DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@localhost:${DB_PORT}/${DB_NAME}
|
||||
sqlx database create
|
||||
|
Loading…
Reference in New Issue
Block a user