Contenu connexe Similaire à Bitbucket pipeline CI (20) Bitbucket pipeline CI9. 敏捷式開發 - 重視配套工具
事件追蹤工具 (issue tracker)
溝通工具 (Slack, Google Chat ... et
c)
專案文件 (Wiki ... etc)
程式碼靜態分析工具
功能測試工具
自動佈署工具
錯誤追蹤 (Rollbar ... etc)
9
10. 敏捷式開發 - 重視配套工具
事件追蹤工具 (issue tracker)
溝通工具 (Slack, Google Chat ... et
c)
專案文件 (Wiki ... etc)
程式碼靜態分析工具
功能測試工具
自動佈署工具
錯誤追蹤 (Rollbar ... etc)
10
本次討論內容
19. Bitbucket Pipelines
19
Docker container
Environment isolation
Set build / test scripts in YAML
Different build / test behaviour
based on different branch
24. 撰寫 bitbucket.yml
24
要使用 PHP 環境
– image: php-7.2
使用 node.js
– image: node:10.15
也可自行建立 docker image
– image: johnroyer/laravel-testing
27. 撰寫 bitbucket.yml
27
透過 step 指定操作順序
pipeline:
default:
- step:
name: build ENV
script:
- cd /home/laravel
- ./artisan XXX
28. 撰寫 bitbucket.yml
28
script 的指令 == shell script
script:
- cd /home/laravel/
- chmod -R 777 storage/
- composer install
- ./artisan key:generate
29. 撰寫 bitbucket.yml
29
注意: bitbucket.yml 均使用 root 執
行
script:
- apt-get install php7.3-cli
- cd /home/laravel/
- chmod -R 777 storage/
- ./artisan key:generate
33. PHP 語法檢查
33
- step
name: "Check PHP syntax"
script:
- find -name '*.php'
-exec php -l {} ;
34. PHP 語法檢查
34
- step
name: "Run php tests"
script:
- composer install
--no-interaction
--no-progress
- vender/bin/phpunit
50. Bitbucket Pipelines
安裝 composer & checkout vendor
curl -ss https://getcomposer.org/installer |
php -- --install-dir=/usr/local/bin
--filename=composer
composer install
--no-interaction
--no-progress
--prefer-dist
50
52. Bitbucket Pipelines
安裝專案會使用到的 extension
apt-get install -y unzip libssl-dev
libmcrypt-dev libpng-dev
docker-php-ext-install
pdo_mysql pdo
zip pcntl
52
53. Bitbucket Pipelines
部 專案比較辛苦份
nvm install 10.XX
nvm use
cd path/to/npm/
npm install
npm run lint
npm run build
53
62. Bitbucket Pipelines
需要 cache 時
1. 檢查 cache target 是否存在
2. 下載 cached files
3. 執行 scripts
4. 順利執行完成,則 cache 未進尚
cache 的 target
( 發生錯誤則不建立 cache)
62