-
Notifications
You must be signed in to change notification settings - Fork 9
137 lines (120 loc) · 4.32 KB
/
Copy pathenvironments.yml
File metadata and controls
137 lines (120 loc) · 4.32 KB
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
name: Environments
# The README offers four ways to run this starterkit. Three of them boot
# containers, which the main CI never touches - it only exercises the
# Docker-free path. These jobs cover the other three, so a broken DDEV
# command or Landofile is found here rather than by someone following
# the README.
#
# They are slow (container build plus a full Composer install), so they
# run when the files they cover change, once a week to catch upstream
# drift, and on demand - not on every push.
on:
push:
paths: &environment-paths
- '.devcontainer/**'
- '.env.example'
- 'drupal/.ddev/**'
- 'drupal/.devtools/**'
- 'drupal/.lando.yml'
- 'package.json'
- 'drupal/composer.json'
- 'drupal/composer.lock'
- 'scripts/**'
- '.github/workflows/environments.yml'
pull_request:
paths: *environment-paths
schedule:
- cron: '0 4 * * 1'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: environments-${{ github.ref }}
cancel-in-progress: true
jobs:
ddev:
name: DDEV
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
# Starts the project too (autostart defaults to true).
- uses: ddev/github-action-setup-ddev@v1
with:
ddevDir: drupal
- name: Install Drupal
working-directory: drupal
run: ddev drupal-install
- name: Create the OAuth consumer
working-directory: drupal
run: |
ddev druxt-add-consumer | tee /tmp/consumer.txt
grep -o 'OAUTH_CLIENT_ID=.*' /tmp/consumer.txt >> ../.env
# The container path builds its consumer with its own script, so
# the local path's coverage does not extend to it.
- name: OAuth consumer is recognised
run: npm run check:oauth
# From inside the web container: no dependency on the runner
# resolving *.ddev.site. -sS so a failure still prints why.
- name: JSON:API responds
working-directory: drupal
run: ddev exec 'curl -sS http://localhost/jsonapi' | tee /dev/stderr | grep -q '"jsonapi"'
lando:
name: Lando
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
# Installs Lando only - unlike the DDEV action it does not start
# the app, so `lando start` is a step of its own below.
- uses: lando/setup-lando@v3
- name: Start Lando
working-directory: drupal
run: lando start
- name: Install Drupal
working-directory: drupal
run: lando drupal-install
- name: Create the OAuth consumer
working-directory: drupal
run: |
lando druxt-add-consumer | tee /tmp/consumer.txt
grep -o 'OAUTH_CLIENT_ID=.*' /tmp/consumer.txt >> ../.env
# Checked from the host over the Lando URL, which is the path a
# user actually takes. `via: nginx` puts the web server in its own
# container, so localhost inside appserver serves nothing.
- name: JSON:API responds
working-directory: drupal
run: |
URL=$(lando info --format json 2>/dev/null \
| jq -r '.[] | select(.service == "appserver") | .urls[]?' \
| grep '^http://' | head -1)
URL="${URL:-http://druxt-quickstart.lndo.site}"
echo "Checking $URL/jsonapi"
curl -sS "$URL/jsonapi" | tee /dev/stderr | grep -q '"jsonapi"'
# Write .env outright: unlike DDEV there is no hook seeding it,
# so a substitution has nothing to match and the check aborts.
printf 'BASE_URL=%s\n' "$URL" > ../.env
grep -o 'OAUTH_CLIENT_ID=.*' /tmp/consumer.txt >> ../.env
cd .. && npm run check:oauth
devcontainer:
name: Dev container
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
# Builds devcontainer.json for real and runs post-create.sh, which
# is the same first-run a DevPod or VS Code user gets.
- uses: devcontainers/ci@v0.3
with:
push: never
runCmd: |
set -e
npm run devtools -- start
. ./.env
curl -sf "${BASE_URL}/jsonapi" | grep -q '"jsonapi"'