From 3050b53d7d720667cc95b90f654229da6beaaeaf Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 26 Jun 2020 12:29:59 +0100 Subject: [PATCH] Test config installation in GitHub Actions Use a SQLite database to test installing the site from the existing configuration. If there is an error with the configuration (e.g. trying to enable a module that isn't present) then the job will fail. Fixes #60 --- .github/workflows/ci.yml | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6082578..28e0e81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,47 @@ on: 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