Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Fix the "post-create-project-cmd" Composer script. #268

Fix the "post-create-project-cmd" Composer script.

Fix the "post-create-project-cmd" Composer script. #268

Workflow file for this run

name: Main
on:
push:
branches: [ main, wip ]
pull_request:
branches: [ main ]
schedule:
# Every twelve (12) hours.
# @see https://crontab.guru/every-12-hours
- cron: 0 */12 * * *
workflow_dispatch:
jobs:
build:
runs-on: "${{ matrix.os }}-latest"
strategy:
fail-fast: false
matrix:
os: [ ubuntu ]
# Temporarily disable the PHP 8.3 job while an APT issue debugged.
# @see https://github.com/phenaproxima/starshot-prototype/issues/19
# php: [ 8.1, 8.2, 8.3 ]
php: [ 8.1, 8.2 ]
steps:
- name: Checkout code
uses: actions/checkout@v4 # https://github.com/marketplace/actions/checkout
- name: Set up PHP CLI
uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action
with:
php-version: "${{ matrix.php }}"
- name: Create project
run: |
set -o xtrace
# Prepare the target directory.
sudo mkdir -p /var/www
sudo rm -rf /var/www/*
sudo chmod 777 /var/www
# Create the project.
git branch -f main || true
git checkout main
composer create-project \
--stability=dev \
--repository='{"type":"vcs","url":"'"$(pwd)"'"}' \
--ansi \
drupal/starshot-project \
/var/www
cd /var/www
# Enable verbose error logging (debug mode).
./vendor/bin/drush config:set --yes system.logging error_level verbose
./vendor/bin/drush config:get system.logging error_level
# @todo The above Drush command doesn't ultimately take effect
# for some reason. Manually change the settings until it can
# be debugged.
echo "if (file_exists(__DIR__ . '/settings.local.php')) {
include __DIR__ . '/settings.local.php';
}" | sudo tee -a web/sites/default/settings.php
sudo cp web/sites/example.settings.local.php \
web/sites/default/settings.local.php
# Make everything writable.
sudo chmod -R 777 /var/www/web
- name: Set up Apache on Linux
if: runner.os == 'Linux'
run: |
set -o xtrace
# Install Apache w/ PHP.
sudo add-apt-repository ppa:ondrej/php
sudo add-apt-repository ppa:ondrej/apache2
sudo apt update
sudo apt install \
apache2 \
php${{ matrix.php }} \
libapache2-mod-php${{ matrix.php }}
sudo a2enmod php${{ matrix.php }}
# Change the default site web directory.
sudo sed -i 's/\/var\/www\/html/\/var\/www\/web/g' /etc/apache2/sites-enabled/000-default.conf
# Start the service.
sudo service apache2 start
- name: Debugging
if: runner.os == 'macOS'
run: |
php -v | head -1
php --ini
- name: Test
run: |
set -o xtrace
php /var/www/vendor/bin/drush core:status
curl http://localhost/ 2>/dev/null