Skip to content

Commit

Permalink
Add a functional test to confirm build integrity
Browse files Browse the repository at this point in the history
  • Loading branch information
twfahey1 committed May 7, 2024
1 parent 980d56a commit 1ed5e9f
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Test and confirm functional build
on:
workflow_dispatch:
push:
jobs:
setup_lamp_environment:
runs-on: ubuntu-latest
env:
path_to_site_codebase_on_runner: ${{ github.workspace }} # Base path where repo is cloned

services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: drupal
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
extensions: mbstring, curl, zip
coverage: none
- name: Setup Apache
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y apache2 libapache2-mod-php8.2 php8.2-mysql
sudo sed -i 's#/var/www/html#${{ env.path_to_site_codebase_on_runner }}/web#g' /etc/apache2/sites-available/000-default.conf
sudo sed -i 's#/var/www/html#${{ env.path_to_site_codebase_on_runner }}/web#g' /etc/apache2/sites-available/default-ssl.conf
sudo systemctl restart apache2
- name: Create settings.local.php
run: |
cat <<EOF > ${{ env.path_to_site_codebase_on_runner }}/web/sites/default/settings.local.php
<?php
\$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'drupal',
'username' => 'root',
'password' => 'root',
'host' => '127.0.0.1',
'port' => '3306',
'prefix' => '',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
EOF
chmod 755 ${{ env.path_to_site_codebase_on_runner }}/web/sites/default/settings.local.php
- name: Install Composer Dependencies
run: |
cd ${{ env.path_to_site_codebase_on_runner }}
composer install --no-progress --no-interaction
- name: Initialize Drupal Installation
run: |
cd ${{ env.path_to_site_codebase_on_runner }}
./vendor/bin/drush si -y
./vendor/bin/drush en aqto_defaults -y
./vendor/bin/drush cr
./vendor/bin/drush uli
sudo chown -R www-data:www-data ${{ env.path_to_site_codebase_on_runner }}/web
# TODO: Since this should now be a functional environment, we could trigger some Playwright tests next.
- name: Start Apache Service
run: sudo systemctl start apache2

0 comments on commit 1ed5e9f

Please sign in to comment.