Attempted update for CI/CD changes
This commit is contained in:
parent
47d3fdf9b8
commit
ea58fc273e
11
.drone.yml
11
.drone.yml
@ -10,7 +10,7 @@ trigger:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: postgresDBTest # Test that the service is ready to be acted upon for cargo tests
|
- name: postgresDBTest # Test that the service is ready to be acted upon for cargo tests
|
||||||
image: postgres:12-alpine
|
image: postgres:12
|
||||||
environment:
|
environment:
|
||||||
PGPASSWORD: password
|
PGPASSWORD: password
|
||||||
DATABASE_URL: postgres://postgres:password@postgres:5432/newsletter
|
DATABASE_URL: postgres://postgres:password@postgres:5432/newsletter
|
||||||
@ -20,13 +20,20 @@ steps:
|
|||||||
|
|
||||||
- name: sqlxMigrate
|
- name: sqlxMigrate
|
||||||
image: rust:1.57
|
image: rust:1.57
|
||||||
|
environment:
|
||||||
|
DATABASE_URL: postgres://postgres:password@postgres:5432/newsletter
|
||||||
|
SKIP_DOCKER:
|
||||||
|
from_secret: SKIP_DOCKER
|
||||||
commands:
|
commands:
|
||||||
- apt update && apt install -y build-essential pkg-config libssl-dev # Dependancies for sqlx
|
- 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
|
- cargo install --version=0.5.7 sqlx-cli --no-default-features --features postgres # Install sqlx
|
||||||
|
- sqlx database create
|
||||||
- sqlx migrate run
|
- sqlx migrate run
|
||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
image: rust:1.57
|
image: rust:1.57
|
||||||
|
environment:
|
||||||
|
APP_ENVIRONMENT: drone
|
||||||
commands:
|
commands:
|
||||||
- apt update && apt install -y build-essential pkg-config libssl-dev # Dependancies for tarpaulin
|
- apt update && apt install -y build-essential pkg-config libssl-dev # Dependancies for tarpaulin
|
||||||
- cargo install cargo-tarpaulin
|
- cargo install cargo-tarpaulin
|
||||||
@ -34,7 +41,7 @@ steps:
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
- name: postgres
|
- name: postgres
|
||||||
image: postgres:12-alpine
|
image: postgres:12
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_PASSWORD: password
|
POSTGRES_PASSWORD: password
|
||||||
|
5
configuration/drone.yaml
Normal file
5
configuration/drone.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
application:
|
||||||
|
host: 127.0.0.1
|
||||||
|
database:
|
||||||
|
host: postgres
|
||||||
|
require_ssl: false
|
@ -77,6 +77,7 @@ pub fn get_configuration() -> Result<Settings, config::ConfigError> {
|
|||||||
pub enum Environment {
|
pub enum Environment {
|
||||||
Local,
|
Local,
|
||||||
Production,
|
Production,
|
||||||
|
Drone
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Environment {
|
impl Environment {
|
||||||
@ -84,6 +85,7 @@ impl Environment {
|
|||||||
match self {
|
match self {
|
||||||
Environment::Local => "local",
|
Environment::Local => "local",
|
||||||
Environment::Production => "production",
|
Environment::Production => "production",
|
||||||
|
Environment::Drone => "drone",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,8 +97,9 @@ impl TryFrom<String> for Environment {
|
|||||||
match s.to_lowercase().as_str() {
|
match s.to_lowercase().as_str() {
|
||||||
"local" => Ok(Self::Local),
|
"local" => Ok(Self::Local),
|
||||||
"production" => Ok(Self::Production),
|
"production" => Ok(Self::Production),
|
||||||
|
"drone" => Ok(Self::Drone),
|
||||||
other => Err(format!(
|
other => Err(format!(
|
||||||
"{} is nto a supported environment. Use either `local` or `production`.", other
|
"{} is nto a supported environment. Use either `local`, `production` or `drone`.", other
|
||||||
)),
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user