[CI] Refactor gitlab-ci.yml + use cache
This commit is dedicated to Schoumi, who is supporting me on Tipeee.
Many thanks ☺️
			
			
This commit is contained in:
		
							parent
							
								
									d39857852c
								
							
						
					
					
						commit
						c8f3c48700
					
				|  | @ -1,12 +1,9 @@ | ||||||
| image: hatsoftwares/lufi-test-ci:latest | image: hatsoftwares/lufi-test-ci:latest | ||||||
| stages: | stages: | ||||||
|   - publish_changelog |   - publish_changelog | ||||||
|   - podcheck |  | ||||||
|   - carton |   - carton | ||||||
|   - carton_bdd |   - carton_bdd | ||||||
|   - tests |   - tests | ||||||
| before_script: |  | ||||||
|   - rm -f *db |  | ||||||
| variables: | variables: | ||||||
|   POSTGRES_DB: lufi_db |   POSTGRES_DB: lufi_db | ||||||
|   POSTGRES_USER: lufi |   POSTGRES_USER: lufi | ||||||
|  | @ -19,33 +16,44 @@ variables: | ||||||
| ### Jobs templates | ### Jobs templates | ||||||
| ## | ## | ||||||
| # | # | ||||||
| .carton_bdd_template: &carton_bdd_definition | .retry: &retry | ||||||
|   stage: carton_bdd |  | ||||||
|   retry: 2 |   retry: 2 | ||||||
|   artifacts: |  | ||||||
|     paths: |  | ||||||
|       - local/ |  | ||||||
|     expire_in: 3 days |  | ||||||
|   dependencies: |  | ||||||
|     - carton |  | ||||||
|   except: |   except: | ||||||
|     - tags |     - tags | ||||||
| .sqlite_template: &sqlite_definition | .carton_bdd_template: &carton_bdd_definition | ||||||
|  |   <<: *retry | ||||||
|  |   stage: carton_bdd | ||||||
|  |   cache: | ||||||
|  |     key: "$CI_COMMIT_REF_NAME" | ||||||
|  |     paths: | ||||||
|  |       - local/ | ||||||
|  |     policy: pull | ||||||
|  |   artifacts: | ||||||
|  |     paths: | ||||||
|  |       - local.tar | ||||||
|  |     expire_in: 3 hours | ||||||
|  |   after_script: | ||||||
|  |     - tar cf local.tar local/ | ||||||
|  | 
 | ||||||
|  | .tests_template: &tests_template | ||||||
|  |   <<: *retry | ||||||
|   stage: tests |   stage: tests | ||||||
|   retry: 2 |   coverage: '/Total.* (\d+\.\d+)$/' | ||||||
|  |   before_script: | ||||||
|  |     - tar xf local.tar && rm local.tar | ||||||
|  |   script: | ||||||
|  |     - MOJO_CONFIG="t/${CI_JOB_NAME}.conf" make test | ||||||
|  |     - MOJO_CONFIG="t/${CI_JOB_NAME}.conf" make cover | ||||||
|  | 
 | ||||||
|  | .sqlite_template: &sqlite_definition | ||||||
|  |   <<: *tests_template | ||||||
|   dependencies: |   dependencies: | ||||||
|     - carton_sqlite |     - carton_sqlite | ||||||
|   services: |   services: | ||||||
|     - name: rroemhild/test-openldap |     - name: rroemhild/test-openldap | ||||||
|       alias: rroemhild-test-openldap |       alias: rroemhild-test-openldap | ||||||
|   coverage: '/Total.* (\d+\.\d+)$/' |  | ||||||
|   except: |  | ||||||
|     - tags |  | ||||||
|   artifacts: |  | ||||||
|     expire_in: 3 days |  | ||||||
| .pg_template: &pg_definition | .pg_template: &pg_definition | ||||||
|   stage: tests |   <<: *tests_template | ||||||
|   retry: 2 |  | ||||||
|   dependencies: |   dependencies: | ||||||
|     - carton_postgresql |     - carton_postgresql | ||||||
|   services: |   services: | ||||||
|  | @ -53,14 +61,8 @@ variables: | ||||||
|       alias: postgres |       alias: postgres | ||||||
|     - name: rroemhild/test-openldap |     - name: rroemhild/test-openldap | ||||||
|       alias: rroemhild-test-openldap |       alias: rroemhild-test-openldap | ||||||
|   coverage: '/Total .*(\d+\.\d+)$/' |  | ||||||
|   except: |  | ||||||
|     - tags |  | ||||||
|   artifacts: |  | ||||||
|     expire_in: 3 days |  | ||||||
| .mysql_template: &mysql_definition | .mysql_template: &mysql_definition | ||||||
|   stage: tests |   <<: *tests_template | ||||||
|   retry: 2 |  | ||||||
|   dependencies: |   dependencies: | ||||||
|     - carton_mysql |     - carton_mysql | ||||||
|   services: |   services: | ||||||
|  | @ -68,11 +70,6 @@ variables: | ||||||
|       alias: mariadb |       alias: mariadb | ||||||
|     - name: rroemhild/test-openldap |     - name: rroemhild/test-openldap | ||||||
|       alias: rroemhild-test-openldap |       alias: rroemhild-test-openldap | ||||||
|   coverage: '/Total .*(\d+\.\d+)$/' |  | ||||||
|   except: |  | ||||||
|     - tags |  | ||||||
|   artifacts: |  | ||||||
|     expire_in: 3 days |  | ||||||
| 
 | 
 | ||||||
| ### Publish tag changelog | ### Publish tag changelog | ||||||
| ## | ## | ||||||
|  | @ -92,30 +89,24 @@ publish_changelog: | ||||||
| ## | ## | ||||||
| # | # | ||||||
| podcheck: | podcheck: | ||||||
|   stage: podcheck |   stage: carton | ||||||
|   script: |   script: | ||||||
|     - make podcheck |     - make podcheck | ||||||
|   except: |   except: | ||||||
|     - tags |     - tags | ||||||
|   artifacts: |  | ||||||
|     expire_in: 3 days |  | ||||||
| 
 | 
 | ||||||
| ### Install common dependencies | ### Install common dependencies | ||||||
| ## | ## | ||||||
| # | # | ||||||
| carton: | carton: | ||||||
|  |   <<: *retry | ||||||
|   stage: carton |   stage: carton | ||||||
|   artifacts: |   cache: | ||||||
|  |     key: "$CI_COMMIT_REF_NAME" | ||||||
|     paths: |     paths: | ||||||
|       - local/ |       - local/ | ||||||
|     expire_in: 3 days |  | ||||||
|   dependencies: [] |  | ||||||
|   script: |   script: | ||||||
|     - carton install --deployment --without=sqlite --without=postgresql --without=mysql |     - carton install --deployment --without=sqlite --without=postgresql --without=mysql | ||||||
|   when: always |  | ||||||
|   retry: 2 |  | ||||||
|   except: |  | ||||||
|     - tags |  | ||||||
| 
 | 
 | ||||||
| ### Install DB related dependencies | ### Install DB related dependencies | ||||||
| ## | ## | ||||||
|  | @ -133,29 +124,12 @@ carton_mysql: | ||||||
|   script: |   script: | ||||||
|     - carton install --deployment --without=sqlite --without=postgresql |     - carton install --deployment --without=sqlite --without=postgresql | ||||||
| 
 | 
 | ||||||
| ### SQLite tests | ### Tests | ||||||
| ## | ## | ||||||
| # | # | ||||||
| sqlite: | sqlite: | ||||||
|   <<: *sqlite_definition |   <<: *sqlite_definition | ||||||
|   script: |  | ||||||
|     - MOJO_CONFIG=t/sqlite.conf make test |  | ||||||
|     - MOJO_CONFIG=t/sqlite.conf make cover |  | ||||||
| 
 |  | ||||||
| ### PostgreSQL tests |  | ||||||
| ## |  | ||||||
| # |  | ||||||
| postgresql: | postgresql: | ||||||
|   <<: *pg_definition |   <<: *pg_definition | ||||||
|   script: |  | ||||||
|     - MOJO_CONFIG=t/postgresql.conf make test |  | ||||||
|     - MOJO_CONFIG=t/postgresql.conf make cover |  | ||||||
| 
 |  | ||||||
| ### MySQL tests |  | ||||||
| ## |  | ||||||
| # |  | ||||||
| mysql: | mysql: | ||||||
|   <<: *mysql_definition |   <<: *mysql_definition | ||||||
|   script: |  | ||||||
|     - MOJO_CONFIG=t/mysql.conf make test |  | ||||||
|     - MOJO_CONFIG=t/mysql.conf make cover |  | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Luc Didry
						Luc Didry