-
Notifications
You must be signed in to change notification settings - Fork 14
77 lines (66 loc) · 2.78 KB
/
TestEnv.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
name: "Test Environment Variables"
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
Test-Env:
runs-on: ubuntu-22.04
strategy:
matrix:
drupal-version: [ 10, 11 ]
steps:
- name: Create a Drupal project
run: |
composer create-project drupal/recommended-project:^${{ matrix.drupal-version }} . --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
- name: Setup Project
run: |
ddev config --auto
ddev start
ddev composer config extra.drupal-scaffold.gitignore true
ddev composer config --json extra.drupal-scaffold.allowed-packages \[\"lullabot/drainpipe\"]
ddev composer config --no-plugins allow-plugins.composer/installers true
ddev composer config --no-plugins allow-plugins.drupal/core-composer-scaffold true
ddev composer config --no-plugins allow-plugins.lullabot/drainpipe true
ddev composer config repositories.drainpipe --json "{\"type\": \"path\", \"url\": \"drainpipe\", \"options\": {\"symlink\": false}}"
ddev composer config minimum-stability dev
cat composer.json | jq --indent 4 '."autoload-dev" = {"files": ["vendor/lullabot/drainpipe/scaffold/env/dotenv.php"]}' | tee composer.json > /dev/null
ddev composer update --lock
ddev composer validate
ddev composer require lullabot/drainpipe --with-all-dependencies
cp drainpipe/tests/fixtures/env/Taskfile.yml Taskfile.yml
- name: Check files are created
run: |
test -f .env
test -f .env.defaults
- name: Check gitignore contains .env
run: grep -q '.env' .gitignore
- name: Test .env.defaults
run: |
echo "FOO=bar" >> .env.defaults
ddev task bar
# Not sure why Drupal needs restarting for this to work
ddev restart
DRUPAL_FOO_DEFAULT=$(ddev drush php:eval "print getenv('FOO')")
echo "FOO=$DRUPAL_FOO_DEFAULT"
if [ "$DRUPAL_FOO_DEFAULT" != "bar" ]; then exit 1; fi
- name: Test overriding with .env
run: |
echo "FOO=baz" >> .env
ddev task baz
# Not sure why Drupal needs restarting for this to work
ddev restart
DRUPAL_FOO=$(ddev drush php:eval "print getenv('FOO')")
echo "FOO=$DRUPAL_FOO"
if [ "$DRUPAL_FOO" != "baz" ]; then exit 1; fi