-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
70 lines (51 loc) · 1.97 KB
/
.gitlab-ci.yml
File metadata and controls
70 lines (51 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
image: ancelade/php-nginx-consumedia-8.3-cicd:latest
before_script:
- apt update && apt install -y sshpass
stages:
- Test
- Deployment
PHPStan:
stage: Test
script:
- composer install
- cp .env.cicd .env
- php artisan key:generate
- apt update && apt install npm nodejs -y && npm i && npm run build
- ./vendor/bin/phpstan analyse --memory-limit=2G
Pest:
stage: Test
script:
- composer install
- cp .env.cicd .env
- php artisan key:generate
- php artisan migrate
- apt update && apt install npm nodejs -y && npm i && npm run build
- php artisan test
#Dusk:
# stage: Test
# script:
# - composer install
# - apt update && apt install -y chromium libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev
# - cp .env.cicd .env
# - php artisan key:generate
# - php artisan migrate
# - php artisan serve --port=80 &
# - php artisan db:seed
# - php artisan dusk:chrome-driver
# - php artisan dusk --colors --debug
# artifacts:
# when: on_failure
# paths:
# - tests/Browser/screenshots/*
deploy_staging:
stage: Deployment
script:
- cd $CI_PROJECT_DIR
- cp $ENV_FILE_STAGING .env
- rm -Rf ./storage/logs
- sshpass -p $SSHPASS ssh -o stricthostkeychecking=no root@$IP 'cd /data/volumes/archethic/staging/app/ && git reset --hard HEAD && git pull && git diff-tree -r --name-only --no-commit-id HEAD HEAD^ > changed_files.txt && git log -1 --pretty=%B > last_commit_message.txt'
- sshpass -p $SSHPASS ssh -o stricthostkeychecking=no root@$IP 'cd /data/volumes/archethic/staging/app/ && npm i && npm run build'
- sshpass -p $SSHPASS scp -o stricthostkeychecking=no -r ./.env root@$IP:/data/volumes/archethic/staging/app/.env
- sshpass -p $SSHPASS ssh -o stricthostkeychecking=no root@$IP 'docker exec $(docker ps --filter "name=archethic_staging_archethic_staging" --format "{{.ID}}" | head -n 1) bash -c "sh after-deploy-web-container.sh staging /var/www"'
only:
- staging