This repository has been archived by the owner on Aug 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
100 lines (82 loc) · 2.86 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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:
ubuntu:
runs-on: ubuntu-latest
container:
image: tugboatqa/php:${{ matrix.php }}-apache
volumes:
- ${{ github.workspace }}:/var/lib/tugboat
strategy:
fail-fast: false
matrix:
os: [ ubuntu ]
php: [ 8.1, 8.2, 8.3 ]
steps:
- name: Checkout code
uses: actions/checkout@v4 # https://github.com/marketplace/actions/checkout
- name: Configure image
run: |
git config --global --add safe.directory /__w/starshot-prototype/starshot-prototype
docker-php-ext-install opcache
a2enmod headers rewrite
echo "memory_limit = -1" >> /usr/local/etc/php/conf.d/my-php.ini
sudo service apache2 start
- name: Create project
run: |
set -o xtrace
sudo apt update
sudo apt install sqlite3
# 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
composer quick-start
# @todo For some reason the Drush "config:set" command run by composer
# create-project to enable verbose logging doesn't ultimately take
# effect. 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
# Symlink docroot.
ln -snf /var/www/web "${DOCROOT}"
# Run cron to populate the search index, etc.
php ./vendor/bin/drush core:cron
- name: Debugging
run: |
set -o xtrace
# Current commit.
git log -s -1 | head -2
# PHP version.
php -v || head -1
# Drush status.
php /var/www/vendor/bin/drush core:status || true
# Apache smoke tests.
curl --silent http://localhost/ | grep "<title>" || true
curl --location --silent http://localhost/node/1 | grep "<title>" || true
- name: Test
working-directory: /var/www
run: composer drupal:run-tests -- --testdox