Output php configurations without escaping them #625 #1912
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |