Test gitlabci #24
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
name: CI/CD Pipeline | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: symfony | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: mbstring, xml, ctype, iconv, intl, pdo_mysql | |
coverage: none | |
- name: Start Docker Containers | |
run: docker-compose up -d | |
- name: List directories | |
run: ls -al | |
- name: Install Composer Dependencies | |
run: composer install --no-dev --no-progress --optimize-autoloader | |
env: | |
COMPOSER_PROCESS_TIMEOUT: 0 | |
COMPOSER_NO_INTERACTION: 1 | |
COMPOSER_NO_AUDIT: 1 | |
working-directory: ./app | |
- name: Run Symfony Migrations | |
run: php bin/console doctrine:migrations:migrate --no-interaction | |
- name: Build and Push Docker Image | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: user/my-app:latest | |
context: . | |
file: ./Dockerfile | |