-
-
Save ibrunotome/9ca65e998fd92488ac2247adcf8c1526 to your computer and use it in GitHub Desktop.
steps: | |
- name: 'gcr.io/cloud-builders/gsutil' | |
args: | |
- cp | |
- .env.testing | |
- .env | |
- name: 'docker/compose:1.23.1' | |
args: | |
- run | |
- app | |
- composer | |
- install | |
- --optimize-autoloader | |
- --no-interaction | |
- --no-ansi | |
- --no-progress | |
- --no-scripts | |
- --prefer-dist | |
- name: 'docker/compose:1.23.1' | |
args: | |
- run | |
- app | |
- vendor/bin/phpunit | |
- --no-coverage | |
- name: 'gcr.io/cloud-builders/gsutil' | |
args: | |
- cp | |
- ${_APP_YAML_CONFIG} | |
- app.yaml | |
- name: 'gcr.io/cloud-builders/gcloud' | |
args: | |
- app | |
- deploy | |
- --no-promote | |
timeout: '600s' |
Sorry, maybe I didn't explain myself, I currently have a Github repository of a project with Laravel, in order to do continuous integration I want a trigger to be fired in cloud build when we create a pull request and run the tests and migrations to be able to validate that the code does not break when it is integrated into develop.
I am new to cloud build and docker, I have read a little about how to use it and to be able to run migrations I have to have a database installed in this case mysql, I have searched the internet and repos on Github if someone has made an example of integration still using cloud build but I have only found deployment examples with docker compose.
When I saw your gist I saw that it runs phpunit but how can we run the migrations?
Thanks greetings.
@arnoldmartinez this way:
- name: 'docker/compose:1.23.1'
args:
- run
- app
- php
- artisan
- migrate
Where app
is your service name in docker-compose.
Github actions is also an easy and free option to run your continuous integration workflow, example:
name: Tests
on: [ pull_request ]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Shutdown Databases
run: |
sudo service postgresql stop
- name: Create .env
run: cp .env.testing .env
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run the containers
run: |
docker-compose -f docker-compose.ci.yml up -d app
sleep 1
- name: Run tests
run: docker exec -t app php artisan test
@bhaidar @arnoldmartinez Sorry fellas, I don't use google app engine anymore. All the steps to deploy on Kubernetes (GKE) here in Portuguese, running migrations etc: https://ibrunotome.github.io/multiplas-aplicacoes-em-um-cluster-kubernetes/
And @arnoldmartinez, how do you want to use docker-compose to run a migration inside GAE? This makes no sense.