From 6ff3c7f483417ccdaec4b2a7432b2442feab4a59 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 30 Oct 2020 00:13:35 +0000 Subject: [PATCH] Combine workflows into one with multiple jobs --- .github/workflows/ci.yml | 165 +++++++++++++++++++++ .github/workflows/coding-standards.yml | 40 ----- .github/workflows/drupal-install.yml | 55 ------- .github/workflows/phpunit.yml | 55 ------- .github/workflows/static-code-analysis.yml | 40 ----- 5 files changed, 165 insertions(+), 190 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/coding-standards.yml delete mode 100644 .github/workflows/drupal-install.yml delete mode 100644 .github/workflows/phpunit.yml delete mode 100644 .github/workflows/static-code-analysis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..deaeda6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,165 @@ +name: CI + +on: + push: + branches: [production] + pull_request: + +jobs: + install: + runs-on: ubuntu-latest + + name: Test Drupal site installation + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: | + ~/.composer/cache/files + web/core + web/modules/contrib + web/themes/contrib + vendor + key: dependencies-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + extensions: mbstring + coverage: none + tools: composer:v1 + + - name: Install dependencies + run: composer install --prefer-dist --no-interaction --no-suggest + + - name: Install Drupal + run: > + vendor/bin/drush --root=$(pwd)/web + site:install -y + --existing-config + --db-url=sqlite://sites/default/files/.ht.sqlite + + - name: Start a web server + run: php -S localhost:8000 -t web 2>&1 & + + - name: Test loading the home page + run: curl http://localhost:8000 + + - name: Verify the home page has the site name in it + run: curl -s http://localhost:8000 | grep "Oliver Davies" + + phpunit: + runs-on: ubuntu-latest + + name: "Run ${{ matrix.test-types }} tests" + + strategy: + matrix: + test-types: + - functional + - kernel + - unit + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: | + ~/.composer/cache/files + web/core + web/modules/constrib + web/themes/contrib + vendor + key: dependencies-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + extensions: mbstring + coverage: none + tools: composer:v1 + + - name: Install dependencies + run: composer install --prefer-dist --no-interaction --no-suggest + + - name: Start the local web server + run: php -S localhost:8000 -t web 2>&1 & + if: matrix.test-types == 'functional' + + - name: Execute tests + run: vendor/bin/phpunit --testdox --colors=always --testsuite=${{ matrix.test-types }} + env: + SIMPLETEST_BASE_URL: http://localhost:8000 + + phpcs: + runs-on: ubuntu-latest + + name: "Run coding standards checks" + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: | + ~/.composer/cache/files + web/core + web/modules/constrib + web/themes/contrib + vendor + key: dependencies-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + tools: composer:v1 + + - name: Install dependencies + run: composer install --prefer-dist --no-interaction --no-suggest + + - name: Run checks + run: vendor/bin/phpcs -s --warning-severity=6 + + phpstan: + runs-on: ubuntu-latest + + name: Static analysis with PHPStan + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: | + ~/.composer/cache/files + web/core + web/modules/constrib + web/themes/contrib + vendor + key: dependencies-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + tools: composer:v1 + + - name: Install dependencies + run: composer install --prefer-dist --no-interaction --no-suggest + + - name: Run checks + run: vendor/bin/phpstan analyze diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml deleted file mode 100644 index f3e3270..0000000 --- a/.github/workflows/coding-standards.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Run coding standards checks - -on: - push: - branches: - - production - pull_request: - -jobs: - phpunit: - runs-on: ubuntu-latest - - name: "Run coding standards checks" - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Cache dependencies - uses: actions/cache@v1 - with: - path: | - ~/.composer/cache/files - web/core - web/modules/constrib - web/themes/contrib - vendor - key: dependencies-composer-${{ hashFiles('composer.json') }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 7.4 - tools: composer:v1 - - - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-suggest - - - name: Run checks - run: vendor/bin/phpcs -s --warning-severity=6 diff --git a/.github/workflows/drupal-install.yml b/.github/workflows/drupal-install.yml deleted file mode 100644 index ad17c93..0000000 --- a/.github/workflows/drupal-install.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Drupal installation - -on: - push: - branches: - - master - pull_request: - -jobs: - install: - runs-on: ubuntu-latest - - name: Test Drupal site installation - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Cache dependencies - uses: actions/cache@v1 - with: - path: | - ~/.composer/cache/files - web/core - web/modules/contrib - web/themes/contrib - vendor - key: dependencies-composer-${{ hashFiles('composer.json') }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 7.4 - extensions: mbstring - coverage: none - tools: composer:v1 - - - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-suggest - - - name: Install Drupal - run: > - vendor/bin/drush --root=$(pwd)/web - site:install -y - --existing-config - --db-url=sqlite://sites/default/files/.ht.sqlite - - - name: Start a web server - run: php -S localhost:8000 -t web 2>&1 & - - - name: Test loading the home page - run: curl http://localhost:8000 - - - name: Verify the home page has the site name in it - run: curl -s http://localhost:8000 | grep "Oliver Davies" diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml deleted file mode 100644 index 2b25889..0000000 --- a/.github/workflows/phpunit.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Run PHPUnit tests - -on: - push: - branches: - - master - pull_request: - -jobs: - phpunit: - runs-on: ubuntu-latest - - name: "Run ${{ matrix.test-types }} tests" - - strategy: - matrix: - test-types: - - functional - - kernel - - unit - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Cache dependencies - uses: actions/cache@v1 - with: - path: | - ~/.composer/cache/files - web/core - web/modules/constrib - web/themes/contrib - vendor - key: dependencies-composer-${{ hashFiles('composer.json') }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 7.4 - extensions: mbstring - coverage: none - tools: composer:v1 - - - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-suggest - - - name: Start the local web server - run: php -S localhost:8000 -t web 2>&1 & - if: matrix.test-types == 'functional' - - - name: Execute tests - run: vendor/bin/phpunit --testdox --colors=always --testsuite=${{ matrix.test-types }} - env: - SIMPLETEST_BASE_URL: http://localhost:8000 diff --git a/.github/workflows/static-code-analysis.yml b/.github/workflows/static-code-analysis.yml deleted file mode 100644 index 7f40f13..0000000 --- a/.github/workflows/static-code-analysis.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Static analysis with PHPStan - -on: - push: - branches: - - production - pull_request: - -jobs: - phpunit: - runs-on: ubuntu-latest - - name: Static analysis with PHPStan - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Cache dependencies - uses: actions/cache@v1 - with: - path: | - ~/.composer/cache/files - web/core - web/modules/constrib - web/themes/contrib - vendor - key: dependencies-composer-${{ hashFiles('composer.json') }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 7.4 - tools: composer:v1 - - - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-suggest - - - name: Run checks - run: vendor/bin/phpstan analyze