diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 28e0e81..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: CI - -on: - push: - branches: - - master - pull_request: - -jobs: - install: - runs-on: ubuntu-latest - - name: Test site installation - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Cache dependencies - uses: actions/cache@v1 - with: - path: ~/.composer/cache/files - key: dependencies-composer-${{ hashFiles('composer.json') }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 7.4 - extensions: mbstring - coverage: none - - - 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" - - tests: - 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 - key: dependencies-composer-${{ hashFiles('composer.json') }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 7.4 - extensions: mbstring - coverage: none - - - 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/drupal-install.yml b/.github/workflows/drupal-install.yml new file mode 100644 index 0000000..ee2eb10 --- /dev/null +++ b/.github/workflows/drupal-install.yml @@ -0,0 +1,54 @@ +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 + + - 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 new file mode 100644 index 0000000..76272d0 --- /dev/null +++ b/.github/workflows/phpunit.yml @@ -0,0 +1,54 @@ +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 + + - 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/.gitignore b/.gitignore index 3c86de6..5a617d1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ !*/ !/.gitignore !/**/.gitkeep -!/.github/ +!/.github/** !/.idea/ !/bin/ !/config/**