Create SECURITY.md #1
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
on: | |
push: | |
branches: | |
- master | |
- develop | |
pull_request: | |
branches: | |
- master | |
- develop | |
name: CI / CD Pipeline | |
jobs: | |
phpunit: | |
name: Test Suite with PHPUnit | |
runs-on: ubuntu-20.04 | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: secret | |
MYSQL_DATABASE: evidentia | |
MYSQL_USER: evidentia | |
MYSQL_PASSWORD: secret | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Verify MySQL connection from host | |
run: | | |
mysql --host 127.0.0.1 --port 3306 -uroot -psecret -e "GRANT ALL ON *.* TO 'evidentia'@'%' identified by 'secret'; FLUSH PRIVILEGES;" | |
mysql --host 127.0.0.1 --port 3306 -uroot -psecret -e "CREATE DATABASE base21;" | |
- uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Install composer dependencies | |
run: | | |
rm composer.lock | |
composer install --no-scripts | |
composer update | |
- name: Prepare Laravel Application | |
run: | | |
cp .env.ci .env | |
php artisan key:generate | |
php artisan migrate | |
php artisan db:seed | |
php artisan db:seed --class=InstancesTableSeeder | |
- name: Run Testsuite | |
run: vendor/bin/phpunit tests/ | |
deployment: | |
name: Push Docker image to Docker Hub | |
needs: phpunit | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: drorganvidez/evidentia | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./build/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |