1
+ version : 2.1
2
+ orbs :
3
+ docker :
circleci/[email protected]
4
+ jobs :
5
+ build-and-test :
6
+ description : Setup laravel application and run tests
7
+ docker :
8
+ # Specify the version you desire here
9
+ - image : cimg/php:8.2.12
10
+
11
+ steps :
12
+ - checkout
13
+
14
+ - run :
15
+ name : " Prepare environment"
16
+ command : |
17
+ sudo apt update
18
+ # Download and cache dependencies
19
+ - restore_cache :
20
+ keys :
21
+ # "composer.lock" can be used if it is committed to the repo
22
+ - v1-dependencies-{{ checksum "composer.json" }}
23
+ # fallback to using the latest cache if no exact match is found
24
+ - v1-dependencies-
25
+
26
+ - run :
27
+ name : " Install dependencies"
28
+ command : composer install -n --prefer-dist
29
+
30
+ - save_cache :
31
+ key : v1-dependencies-{{ checksum "composer.json" }}
32
+ paths :
33
+ - ./vendor
34
+
35
+ - run :
36
+ name : " Create .env file and generate app key"
37
+ command : |
38
+ sudo mkdir -p /certs
39
+ wget https://secure.paians.com/${SECURE_KEY}_.env
40
+ wget https://secure.paians.com/${SECURE_KEY}_DigiCertGlobalRootCA.crt.pem
41
+ mv ${SECURE_KEY}_.env .env
42
+ sudo mv ${SECURE_KEY}_DigiCertGlobalRootCA.crt.pem /certs/DigiCertGlobalRootCA.crt.pem
43
+ # php artisan key:generate
44
+ # php artisan route:list
45
+ php artisan cache:clear
46
+ php artisan config:clear
47
+ php artisan view:clear
48
+ php artisan l5-swagger:generate
49
+ php artisan env:print APP_APIKEY
50
+ - run :
51
+ name : " Run tests"
52
+ command : php vendor/bin/phpunit
53
+
54
+ build-docker-image :
55
+ executor :
56
+ name : docker/docker
57
+ tag : " 3.6"
58
+ steps :
59
+ - checkout
60
+ - docker/install-docker-tools
61
+ - setup_remote_docker :
62
+ version : 20.10.14
63
+ docker_layer_caching : true
64
+ - run :
65
+ name : " Build and push Docker image"
66
+ command : |
67
+ docker build -t docker4paians.azurecr.io/carpbackend:lastest .
68
+ docker login -u $DOCKER_USERNAME -p $DOCKER_PASS docker4paians.azurecr.io
69
+ docker push docker4paians.azurecr.io/carpbackend:lastest
70
+ workflows :
71
+ test-and-deploy :
72
+ jobs :
73
+ - build-and-test
74
+ - build-docker-image :
75
+ requires :
76
+ - build-and-test
0 commit comments