-
Notifications
You must be signed in to change notification settings - Fork 14
140 lines (122 loc) · 6.11 KB
/
TestTugboat.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: "Test Tugboat"
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
Test-Tugboat:
runs-on: ubuntu-24.04
steps:
- name: Create a Drupal project
run: composer create-project drupal/recommended-project . --ignore-platform-reqs
- uses: actions/checkout@v4
with:
path: drainpipe
- uses: ./drainpipe/scaffold/github/actions/common/set-env
- name: Install DDEV
uses: ./drainpipe/scaffold/github/actions/common/ddev
with:
git-name: Drainpipe Bot
git-email: no-reply@example.com
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
# Lock in versions so tests know what to expect.
# Redis tag v1.2.0 == 6-bullseye
# Elasticsearch tag v0.3.2 == 7.17.14
- name: Setup Project
run: |
ddev config --auto
ddev config --php-version "8.3"
ddev config --nodejs-version "18"
ddev get ddev/ddev-redis --version v1.2.0
ddev get ddev/ddev-elasticsearch --version v0.3.2
ddev restart
ddev exec --raw composer config extra.drupal-scaffold.gitignore true
ddev exec --raw composer config --json extra.drupal-scaffold.allowed-packages \[\"lullabot/drainpipe\"]
ddev exec --raw composer config --no-plugins allow-plugins.composer/installers true
ddev exec --raw composer config --no-plugins allow-plugins.drupal/core-composer-scaffold true
ddev exec --raw composer config --no-plugins allow-plugins.lullabot/drainpipe true
ddev exec --raw composer config repositories.drainpipe --json '{"type": "path", "url": "drainpipe", "options": {"symlink": false}}'
ddev exec --raw composer config minimum-stability dev
ddev exec --raw composer config extra.drainpipe --json '{"tugboat": {}}'
mkdir -p .tugboat
echo "php:" > .tugboat/config.drainpipe-override.yml
echo " aliases:" >> .tugboat/config.drainpipe-override.yml
echo " - foo" >> .tugboat/config.drainpipe-override.yml
echo " urls:" >> .tugboat/config.drainpipe-override.yml
echo " - /" >> .tugboat/config.drainpipe-override.yml
echo " - /?v=1" >> .tugboat/config.drainpipe-override.yml
echo " screenshot:" >> .tugboat/config.drainpipe-override.yml
echo " timeout: 45" >> .tugboat/config.drainpipe-override.yml
echo " visualdiff:" >> .tugboat/config.drainpipe-override.yml
echo " fullPage: false" >> .tugboat/config.drainpipe-override.yml
ddev composer require lullabot/drainpipe --with-all-dependencies
- name: Add an online step
run: |
echo " online:tugboat:" >> Taskfile.yml
echo " cmds:" >> Taskfile.yml
echo " - echo \"Tugboat online\"" >> Taskfile.yml
ddev composer install
# Compare the generated files to the ones used to build this repository
# preview - they should be the same.
- name: Test Generated Files
run: |
diff -up drainpipe/.tugboat/config.yml .tugboat/config.yml
sed -i '/#drainpipe-start/,/#drainpipe-end/d' drainpipe/.tugboat/steps/1-init.sh
sed -i '/#drainpipe-start/,/#drainpipe-end/d' drainpipe/.tugboat/steps/2-update.sh
sed -i '/#drainpipe-start/,/#drainpipe-end/d' drainpipe/.tugboat/steps/3-build.sh
sed -i '/#drainpipe-start/,/#drainpipe-end/d' drainpipe/.tugboat/steps/4-online.sh
diff -up drainpipe/.tugboat/steps/1-init.sh .tugboat/steps/1-init.sh
diff -up drainpipe/.tugboat/steps/2-update.sh .tugboat/steps/2-update.sh
diff -up drainpipe/.tugboat/steps/3-build.sh .tugboat/steps/3-build.sh
diff -up drainpipe/.tugboat/steps/4-online.sh .tugboat/steps/4-online.sh
- name: Add a build:tugboat step
run: |
echo " build:tugboat:" >> Taskfile.yml
echo " cmds:" >> Taskfile.yml
echo " - echo \"Tugboat build\"" >> Taskfile.yml
ddev composer install
if ! grep -q './vendor/bin/task build:tugboat' .tugboat/steps/3-build.sh; then
exit 1
fi
- name: Upload test artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: .tugboat
path: .tugboat
Test-Non-Default-Nodejs:
runs-on: ubuntu-24.04
steps:
- name: Create a Drupal project
run: composer create-project drupal/recommended-project . --ignore-platform-req=ext-gd
- uses: actions/checkout@v4
with:
path: drainpipe
- uses: ./drainpipe/scaffold/github/actions/common/set-env
- name: Install DDEV
uses: ./drainpipe/scaffold/github/actions/common/ddev
with:
git-name: Drainpipe Bot
git-email: no-reply@example.com
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Setup Project
run: |
ddev config --auto
ddev config --php-version "8.3"
ddev config --nodejs-version "16"
ddev restart
ddev exec --raw composer config extra.drupal-scaffold.gitignore true
ddev exec --raw composer config --json extra.drupal-scaffold.allowed-packages \[\"lullabot/drainpipe\"]
ddev exec --raw composer config --no-plugins allow-plugins.composer/installers true
ddev exec --raw composer config --no-plugins allow-plugins.drupal/core-composer-scaffold true
ddev exec --raw composer config --no-plugins allow-plugins.lullabot/drainpipe true
ddev exec --raw composer config repositories.drainpipe --json '{"type": "path", "url": "drainpipe", "options": {"symlink": false}}'
ddev exec --raw composer config minimum-stability dev
ddev exec --raw composer config extra.drainpipe --json '{"tugboat": {}}'
ddev composer require lullabot/drainpipe --with-all-dependencies
- name: Test NODE_MAJOR is correct
run: |
cat .tugboat/steps/1-init.sh
grep -q NODE_MAJOR=16 .tugboat/steps/1-init.sh