Merge branch 'develop' into renovate/serde-1.x
	
		
			
	
		
	
	
		
			
				
	
				continuous-integration/drone the build was successful
				
					Details
				
			
		
	
				
					
				
			
				
	
				continuous-integration/drone the build was successful
				
					Details
				
			
		
	
						commit
						be797de526
					
				|  | @ -1,43 +1,91 @@ | ||||||
| pipeline: | pipeline: | ||||||
|  |     # Download the cache from S3 | ||||||
|  |     restore-cache: | ||||||
|  |         image: plugins/s3-cache | ||||||
|  |         pull: true | ||||||
|  | 
 | ||||||
|  |         endpoint: https://s3.roosens.me | ||||||
|  |         root: build-cache/ | ||||||
|  |         restore: true | ||||||
|  | 
 | ||||||
|  |         secrets: [ cache_s3_access_key, cache_s3_secret_key ] | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     # =====BUILDING===== | ||||||
|     build-frontend: |     build-frontend: | ||||||
|         image: node:15-alpine3.13 |         image: node:15-alpine3.13 | ||||||
|         pull: true |         pull: true | ||||||
|  |         group: build | ||||||
|         commands: |         commands: | ||||||
|             - cd web |             - cd web | ||||||
|             - yarn install |             - yarn install | ||||||
|             - yarn run build |             - yarn run build | ||||||
| 
 | 
 | ||||||
|  |     build-backend: | ||||||
|  |         image: chewingbever/fej-builder:latest | ||||||
|  |         pull: true | ||||||
|  |         group: build | ||||||
|  |         environment: | ||||||
|  |             - CARGO_HOME=.cargo | ||||||
|  |         commands: | ||||||
|  |             - cargo build | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     # =====TESTING===== | ||||||
|  |     test-backend: | ||||||
|  |         image: chewingbever/fej-builder:latest | ||||||
|  |         environment: | ||||||
|  |             - CARGO_HOME=.cargo | ||||||
|  |         commands: | ||||||
|  |             - cargo test | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     # =====LINTING===== | ||||||
|     lint-frontend: |     lint-frontend: | ||||||
|         image: node:15-alpine3.13 |         image: node:15-alpine3.13 | ||||||
|  |         group: lint | ||||||
|         commands: |         commands: | ||||||
|             - cd web |             - cd web | ||||||
|             - yarn run lint |             - yarn run lint | ||||||
| 
 | 
 | ||||||
|     # This doesn't require compiling anything |  | ||||||
|     lint-backend: |     lint-backend: | ||||||
|         image: chewingbever/fej-builder:latest |         image: chewingbever/fej-builder:latest | ||||||
|         pull: true |         group: lint | ||||||
|  |         environment: | ||||||
|  |             - CARGO_HOME=.cargo | ||||||
|         commands: |         commands: | ||||||
|             - cargo fmt -- --check |             - cargo fmt -- --check | ||||||
|  |             # This is run here because it requires compilation | ||||||
|  |             - cargo clippy --all-targets -- -D warnings | ||||||
|  |      | ||||||
| 
 | 
 | ||||||
|     # publish-builder: |     # =====REBUILD & FLUSH CACHE===== | ||||||
|     #     image: plugins/docker |     rebuild-cache: | ||||||
|     #     repo: chewingbever/fej-builder |         image: plugins/s3-cache | ||||||
|     #     dockerfile: docker/Dockerfile.builder |  | ||||||
|     #     tag: [ latest ] |  | ||||||
|     #     secrets: [ docker_username, docker_password ] |  | ||||||
|     #     when: |  | ||||||
|     #         branch: develop |  | ||||||
|     #         event: push |  | ||||||
| 
 | 
 | ||||||
|     # Backend cicd jobs are disabled until we can figure out a way to cache stuff |         endpoint: https://s3.roosens.me | ||||||
|     # test-backend: |         root: build-cache/ | ||||||
|     #     image: chewingbever/fej-builder:latest |         rebuild: true | ||||||
|     #     # Always update the builder image |         mount: | ||||||
|     #     pull: true |             - target | ||||||
|     #     commands: |             - .cargo | ||||||
|     #         - cargo test |             - web/node_modules | ||||||
| 
 | 
 | ||||||
|     # TODO build dev & rel image, deploy these images |         secrets: [ cache_s3_access_key, cache_s3_secret_key ] | ||||||
|  |         # Push the cache, even on failure | ||||||
|  |         when: | ||||||
|  |             status: [ success, failure ] | ||||||
| 
 | 
 | ||||||
| # branches: [ master, develop ] |     flush-cache: | ||||||
|  |         image: plugins/s3-cache | ||||||
|  | 
 | ||||||
|  |         endpoint: https://s3.roosens.me | ||||||
|  |         root: build-cache/ | ||||||
|  |         flush: true | ||||||
|  |         # Delete cache older than 30 days (might lower this) | ||||||
|  |         flush_age: 30 | ||||||
|  | 
 | ||||||
|  |         secrets: [ cache_s3_access_key, cache_s3_secret_key ] | ||||||
|  |         # Push the cache, even on failure | ||||||
|  |         when: | ||||||
|  |             status: [ success, failure ] | ||||||
|  |  | ||||||
|  | @ -16,10 +16,7 @@ impl PickupTime { | ||||||
|     /// * `date` - Date of pickup time
 |     /// * `date` - Date of pickup time
 | ||||||
|     /// * `label` - Type of trash
 |     /// * `label` - Type of trash
 | ||||||
|     pub fn new(date: BasicDate, label: String) -> PickupTime { |     pub fn new(date: BasicDate, label: String) -> PickupTime { | ||||||
|         PickupTime { |         PickupTime { date, label } | ||||||
|             date: date, |  | ||||||
|             label: label, |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -18,10 +18,7 @@ impl Street { | ||||||
|     // This constructor just makes my life a bit easier during testing
 |     // This constructor just makes my life a bit easier during testing
 | ||||||
|     #[cfg(test)] |     #[cfg(test)] | ||||||
|     fn new(name: String, city: String) -> Street { |     fn new(name: String, city: String) -> Street { | ||||||
|         Street { |         Street { name, city } | ||||||
|             name: name, |  | ||||||
|             city: city, |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -8,12 +8,15 @@ fn main() { | ||||||
|     let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set"); |     let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set"); | ||||||
| 
 | 
 | ||||||
|     let db_conn = PgConnection::establish(&database_url) |     let db_conn = PgConnection::establish(&database_url) | ||||||
|         .expect(&format!("Error connecting to {}", database_url)); |         .unwrap_or_else(|_| panic!("Error connecting to {}", database_url)); | ||||||
| 
 | 
 | ||||||
|     // Doing this linearly is good enough I'd say
 |     // Doing this linearly is good enough I'd say
 | ||||||
|     for c in ABC.chars() { |     for c in ABC.chars() { | ||||||
|         if let Ok(streets) = search_streets(&c.to_string()) { |         if let Ok(streets) = search_streets(&c.to_string()) { | ||||||
|             insert_into(ivago_streets).values(streets).execute(&db_conn); |             insert_into(ivago_streets) | ||||||
|  |                 .values(streets) | ||||||
|  |                 .execute(&db_conn) | ||||||
|  |                 .expect("Failed to insert rows."); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -23,9 +23,9 @@ use rocket_contrib::databases::diesel; | ||||||
| #[cfg(feature = "frontend")] | #[cfg(feature = "frontend")] | ||||||
| use rocket_contrib::serve::StaticFiles; | use rocket_contrib::serve::StaticFiles; | ||||||
| 
 | 
 | ||||||
| pub struct CORS; | pub struct Cors; | ||||||
| 
 | 
 | ||||||
| impl Fairing for CORS { | impl Fairing for Cors { | ||||||
|     fn info(&self) -> Info { |     fn info(&self) -> Info { | ||||||
|         Info { |         Info { | ||||||
|             name: "Add CORS headers to responses", |             name: "Add CORS headers to responses", | ||||||
|  | @ -63,8 +63,9 @@ fn run_db_migrations(rocket: Rocket) -> Result<Rocket, Rocket> { | ||||||
| 
 | 
 | ||||||
| fn rocket() -> rocket::Rocket { | fn rocket() -> rocket::Rocket { | ||||||
|     // This needs to be muted for the frontend feature
 |     // This needs to be muted for the frontend feature
 | ||||||
|  |     #[allow(unused_mut)] | ||||||
|     let mut rocket = rocket::ignite() |     let mut rocket = rocket::ignite() | ||||||
|         .attach(CORS) |         .attach(Cors) | ||||||
|         .attach(FejDbConn::fairing()) |         .attach(FejDbConn::fairing()) | ||||||
|         .attach(AdHoc::on_attach("Database Migrations", run_db_migrations)) |         .attach(AdHoc::on_attach("Database Migrations", run_db_migrations)) | ||||||
|         .mount("/api/ivago", routes::ivago()) // /api being hardcoded is temporary
 |         .mount("/api/ivago", routes::ivago()) // /api being hardcoded is temporary
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue