From d10a116ac0c315ba814c70ebe679900144e5e2a6 Mon Sep 17 00:00:00 2001 From: Andrea Giannantonio Date: Mon, 15 Mar 2021 17:22:27 +0100 Subject: [PATCH] feat: github actions tests --- .github/workflows/staging.yaml | 41 ++++++++++++++++++++++++++++++++++ .github/workflows/tests.yaml | 32 ++++++++++++++++++++++++++ README.md | 5 ++++- 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/staging.yaml create mode 100644 .github/workflows/tests.yaml diff --git a/.github/workflows/staging.yaml b/.github/workflows/staging.yaml new file mode 100644 index 0000000..95bd3fd --- /dev/null +++ b/.github/workflows/staging.yaml @@ -0,0 +1,41 @@ +name: Deploy on Staging + +on: + push: + branches: + - master + - feat/github-actions-tests + +jobs: + tests: + runs-on: ubuntu-latest + + container: jellybellydev/ci-cd-theory-into-practice:latest + + name: "CI⚡CD: the theory put into practice" + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Prepare artifact deployable + run: | + echo "APP_ENV=staging" >> .env.local + composer install --no-dev --optimize-autoloader + composer dump-autoload --no-dev --classmap-authoritative + composer dump-env + + - name: Publish artifact + uses: actions/upload-artifact@v2 + with: + name: staging-artifact + path: | + bin/** + config/** + public/** + src/** + vendor/** + .env + .env.local + .env.local.php + composer.json diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..8a99d9a --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,32 @@ +name: CI + +on: + push: + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + + container: jellybellydev/ci-cd-theory-into-practice:latest + + name: "CI⚡CD: the theory put into practice" + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install dependencies + run: composer install + + - name: Check php-cs-fixer + run: vendor/bin/php-cs-fixer fix --verbose --diff --dry-run + + - name: Lint yaml config + run: bin/console lint:yaml config + + - name: Phpunit + run: XDEBUG_MODE=coverage bin/phpunit --colors=never --coverage-text + + - name: Psalm + run: vendor/bin/psalm diff --git a/README.md b/README.md index c978282..346a6e1 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,11 @@ ![Logo](./stuff/ci-cd-logo-250.png) # CI⚡CD: the theory put into practice +GitLab: [![pipeline status](https://gitlab.com/JellyBellyDev/ci-cd-theory-into-practice/badges/master/pipeline.svg)](https://gitlab.com/JellyBellyDev/ci-cd-theory-into-practice/-/commits/master) -[![coverage report](https://gitlab.com/JellyBellyDev/ci-cd-theory-into-practice/badges/master/coverage.svg)](https://gitlab.com/JellyBellyDev/ci-cd-theory-into-practice/-/commits/master) +[![coverage report](https://gitlab.com/JellyBellyDev/ci-cd-theory-into-practice/badges/master/coverage.svg)](https://gitlab.com/JellyBellyDev/ci-cd-theory-into-practice/-/commits/master) +GitHub: +![CI](https://github.com/JellyBellyDev/ci-cd-theory-into-practice/workflows/CI/badge.svg) > This is a sample repository to show a possible configuration of a GitLab pipeline and deploy with Ansible for a software written in php with Symfony framework.