Last active
February 23, 2022 15:50
-
-
Save ibrunotome/9ca65e998fd92488ac2247adcf8c1526 to your computer and use it in GitHub Desktop.
Cloud Build example settings for a Laravel application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@arnoldmartinez this way:
Where
app
is your service name in docker-compose.