This repository has been archived by the owner on Apr 15, 2024. It is now read-only.
Trying to remove the commits to just stacking up when merging the dev to the prod #237
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 | |
on: | |
push: | |
branches: [prod, dev] | |
pull_request: | |
branches: [prod, dev] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mariadb: | |
image: mariadb:10 | |
env: | |
MYSQL_USER: test | |
MYSQL_PASSWORD: test | |
MYSQL_DATABASE: integration_test | |
MYSQL_RANDOM_ROOT_PASSWORD: yes | |
ports: | |
- 3306:3306 | |
options: --name mariadb --health-cmd="mysqladmin ping" --health-interval=1s --health-timeout=5s --health-retries=3 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 7.4 | |
tools: phpunit | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- run: cp .env.test .env | |
- run: composer self-update | |
- run: composer install --ignore-platform-reqs --no-interaction --prefer-dist | |
- run: php artisan config:cache | |
- run: php artisan key:generate | |
- run: php artisan migrate --seed | |
# - run: phpunit the tests need to be debugged | |
- uses: lazy-actions/slatify@master | |
if: failure() | |
with: | |
type: ${{ job.status }} | |
job_name: "*Job ${{ github.job }}*" | |
commit: true | |
url: ${{ secrets.SLACK_WEBHOOK_URL }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
if: github.ref == 'refs/heads/prod' || github.ref == 'refs/heads/dev' | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
env: | |
RESOURCE_NAME: ${{ github.ref == 'refs/heads/prod' && 'integration-prod' || 'integration-dev' }} | |
NAMESPACE: ${{ github.ref == 'refs/heads/prod' && 'integration-prod' || 'integration-dev' }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install oc | |
uses: redhat-actions/oc-installer@v1 | |
with: | |
oc_version: "4.6" | |
- name: Login to OKD | |
run: oc login --token=${{ secrets.OKD_TOKEN }} --server=${{ secrets.OKD_SERVER }} | |
- name: Change the project | |
run: oc project ${{ env.NAMESPACE }} | |
- name: Start the build | |
run: oc start-build ${{ env.RESOURCE_NAME }} --follow | |
- uses: lazy-actions/slatify@master | |
if: always() | |
with: | |
type: ${{ job.status }} | |
job_name: "*Deployment to ${{ env.RESOURCE_NAME }}*" | |
commit: true | |
url: ${{ secrets.SLACK_WEBHOOK_URL }} | |
token: ${{ secrets.GITHUB_TOKEN }} |