From c15836a15dc8132896a332cd69688440538812d8 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 30 Dec 2019 12:00:25 +0100 Subject: [PATCH 1/5] Create main.yml --- .github/workflows/main.yml | 173 +++++++++++++++++++++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..1a3d90a28 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,173 @@ +name: CI/CD + +on: [push] + +jobs: + code-tests: + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: false + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: oms + ports: + - 3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + postgres: + image: postgres:10.8 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: root + POSTGRES_DB: oms + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 + redis: + image: redis + ports: + - 6379:6379 + options: --entrypoint redis-server + memcached: + image: memcached + ports: + - 11211:11211 + strategy: + fail-fast: false + max-parallel: 3 + matrix: + php-versions: ['7.4'] + steps: + - name: Checkout Repository + uses: actions/checkout@master + with: + fetch-depth: 1 + - name: Checkout Build Repository + uses: actions/checkout@master + with: + fetch-depth: 1 + repository: Orange-Management/Build + path: Build + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@master + with: + php-version: ${{ matrix.php-versions }} + extension-csv: mbstring, gd, zip, dom, mysql, pgsql, sqlite, imap, bcmath, redis, memcached + ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1 + coverage: pcov + - name: Get Composer Cache Directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Setup Composer + run: composer install + - name: phpunit + run: vendor/bin/phpunit --coverage-text -v --configuration tests/phpunit_no_coverage.xml + static-tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 3 + matrix: + php-versions: ['7.4'] + steps: + - name: Checkout Repository + uses: actions/checkout@master + with: + fetch-depth: 1 + - name: Checkout Build Repository + uses: actions/checkout@master + with: + fetch-depth: 1 + repository: Orange-Management/Build + path: Build + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@master + with: + php-version: ${{ matrix.php-versions }} + extension-csv: mbstring, gd, zip, dom, mysql, pgsql, sqlite, imap, bcmath, redis, memcached + ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1 + - name: Get Composer Cache Directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Setup Composer + run: composer install + - name: phpstan + run: vendor/bin/phpstan analyse -a phpOMS/Autoloader.php --no-progress -l 7 -c Build/Config/phpstan.neon ./ + codestyle-tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 3 + matrix: + php-versions: ['7.4'] + steps: + - name: Checkout Repository + uses: actions/checkout@master + with: + fetch-depth: 1 + - name: Checkout Build Repository + uses: actions/checkout@master + with: + fetch-depth: 1 + repository: Orange-Management/Build + path: Build + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@master + with: + php-version: ${{ matrix.php-versions }} + extension-csv: mbstring, gd, zip, dom, mysql, pgsql, sqlite, imap, bcmath, redis, memcached + ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1 + - name: Get Composer Cache Directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Setup Composer + run: composer install + - name: phpcs + run: vendor/bin/phpcs ./ --standard="Build/Config/phpcs.xml" -s --report=full + custom: + runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 3 + matrix: + php-versions: ['7.4', '8.0'] + steps: + - name: Checkout Repository + uses: actions/checkout@master + with: + fetch-depth: 1 + - name: Checkout Build Repository + uses: actions/checkout@master + with: + fetch-depth: 1 + repository: Orange-Management/Build + path: Build + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@master + with: + php-version: ${{ matrix.php-versions }} + extension-csv: mbstring, gd, zip, dom, mysql, pgsql, sqlite, imap, bcmath, redis, memcached + ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1 + - name: PHP linting + run: find ./Web ./phpOMS ./Build ./Modules -type f -name '*.php' -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" ) + - name: Php strict + run: if [[ $(grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ./phpOMS ./Web ./Modules ./Model) -ne "" ]]; then exit 1; fi From cbe1f208c3ee5183755a4d5ce1d06a0cdeed9548 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 30 Dec 2019 12:02:57 +0100 Subject: [PATCH 2/5] Update main.yml --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a3d90a28..b656e0715 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -105,7 +105,7 @@ jobs: - name: Setup Composer run: composer install - name: phpstan - run: vendor/bin/phpstan analyse -a phpOMS/Autoloader.php --no-progress -l 7 -c Build/Config/phpstan.neon ./ + run: vendor/bin/phpstan analyse -a Autoloader.php --no-progress -l 7 -c Build/Config/phpstan.neon ./ codestyle-tests: runs-on: ubuntu-latest strategy: @@ -168,6 +168,6 @@ jobs: extension-csv: mbstring, gd, zip, dom, mysql, pgsql, sqlite, imap, bcmath, redis, memcached ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1 - name: PHP linting - run: find ./Web ./phpOMS ./Build ./Modules -type f -name '*.php' -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" ) + run: find ./ -type f -name '*.php' -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" ) - name: Php strict - run: if [[ $(grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ./phpOMS ./Web ./Modules ./Model) -ne "" ]]; then exit 1; fi + run: if [[ $(grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ./) -ne "" ]]; then exit 1; fi From 39a3a129d60c2bc15e55132c79c8528bfd1494da Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 30 Dec 2019 12:08:08 +0100 Subject: [PATCH 3/5] Update main.yml --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b656e0715..817047060 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,7 +48,7 @@ jobs: with: fetch-depth: 1 repository: Orange-Management/Build - path: Build + path: ../Build - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@master with: @@ -86,7 +86,7 @@ jobs: with: fetch-depth: 1 repository: Orange-Management/Build - path: Build + path: ../Build - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@master with: @@ -105,7 +105,7 @@ jobs: - name: Setup Composer run: composer install - name: phpstan - run: vendor/bin/phpstan analyse -a Autoloader.php --no-progress -l 7 -c Build/Config/phpstan.neon ./ + run: vendor/bin/phpstan analyse -a Autoloader.php --no-progress -l 7 -c ../Build/Config/phpstan.neon ./ codestyle-tests: runs-on: ubuntu-latest strategy: @@ -123,7 +123,7 @@ jobs: with: fetch-depth: 1 repository: Orange-Management/Build - path: Build + path: ../Build - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@master with: @@ -142,7 +142,7 @@ jobs: - name: Setup Composer run: composer install - name: phpcs - run: vendor/bin/phpcs ./ --standard="Build/Config/phpcs.xml" -s --report=full + run: vendor/bin/phpcs ./ --standard="../Build/Config/phpcs.xml" -s --report=full custom: runs-on: ubuntu-latest strategy: @@ -160,7 +160,7 @@ jobs: with: fetch-depth: 1 repository: Orange-Management/Build - path: Build + path: ../Build - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@master with: From c8830380e568516e2d3deccbcedcdc4663e18d14 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 30 Dec 2019 12:12:12 +0100 Subject: [PATCH 4/5] Update main.yml --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 817047060..b656e0715 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,7 +48,7 @@ jobs: with: fetch-depth: 1 repository: Orange-Management/Build - path: ../Build + path: Build - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@master with: @@ -86,7 +86,7 @@ jobs: with: fetch-depth: 1 repository: Orange-Management/Build - path: ../Build + path: Build - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@master with: @@ -105,7 +105,7 @@ jobs: - name: Setup Composer run: composer install - name: phpstan - run: vendor/bin/phpstan analyse -a Autoloader.php --no-progress -l 7 -c ../Build/Config/phpstan.neon ./ + run: vendor/bin/phpstan analyse -a Autoloader.php --no-progress -l 7 -c Build/Config/phpstan.neon ./ codestyle-tests: runs-on: ubuntu-latest strategy: @@ -123,7 +123,7 @@ jobs: with: fetch-depth: 1 repository: Orange-Management/Build - path: ../Build + path: Build - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@master with: @@ -142,7 +142,7 @@ jobs: - name: Setup Composer run: composer install - name: phpcs - run: vendor/bin/phpcs ./ --standard="../Build/Config/phpcs.xml" -s --report=full + run: vendor/bin/phpcs ./ --standard="Build/Config/phpcs.xml" -s --report=full custom: runs-on: ubuntu-latest strategy: @@ -160,7 +160,7 @@ jobs: with: fetch-depth: 1 repository: Orange-Management/Build - path: ../Build + path: Build - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@master with: From 71b48818859a3530c1e6d93579e424387287efd9 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 30 Dec 2019 12:18:21 +0100 Subject: [PATCH 5/5] Update main.yml --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b656e0715..0e37abd90 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,6 +47,7 @@ jobs: uses: actions/checkout@master with: fetch-depth: 1 + ref: develop repository: Orange-Management/Build path: Build - name: Setup PHP, with composer and extensions @@ -85,6 +86,7 @@ jobs: uses: actions/checkout@master with: fetch-depth: 1 + ref: develop repository: Orange-Management/Build path: Build - name: Setup PHP, with composer and extensions @@ -122,6 +124,7 @@ jobs: uses: actions/checkout@master with: fetch-depth: 1 + ref: develop repository: Orange-Management/Build path: Build - name: Setup PHP, with composer and extensions @@ -159,6 +162,7 @@ jobs: uses: actions/checkout@master with: fetch-depth: 1 + ref: develop repository: Orange-Management/Build path: Build - name: Setup PHP, with composer and extensions