Skip to content

Commit 77ed07a

Browse files
authored
move env vars to the "job" level (laravel#8264)
Github Actions allows you to place environment variables at either the "workflow", "job", or "step" level. This commit moves them from the "step" level to the "job" level. https://docs.github.com/en/actions/learn-github-actions/environment-variables Dusk is a unique situation because running `php artisan dusk` starts the tests in one process, but hitting `$this->browse()` within the test spawns a **new** process, that **DOES NOT** inherit the environment variables set at the "step" level. Therefore, for Dusk CI on Github, it's better to set ENV variables at the "job" level so both the "test process" and "browser process" inherit them. Added the `DB_USERNAME`, `DB_PASSWORD`, and `MAIL_MAILER` env variables. The current value in the default `.env.example` for the password is empty, so we'll set it here to match the default Github Action MySQL password. The default `MAIL_MAILER` value is "smtp" and points to Mailhog, which **is not** running on Github Actions, and will throw an Exception if an email is attempted to be sent, so we'll use "log" to avoid that.
1 parent b7059b1 commit 77ed07a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

dusk.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,6 +1920,11 @@ jobs:
19201920
19211921
dusk-php:
19221922
runs-on: ubuntu-latest
1923+
env:
1924+
APP_URL: "http://127.0.0.1:8000"
1925+
DB_USERNAME: root
1926+
DB_PASSWORD: root
1927+
MAIL_MAILER: log
19231928
steps:
19241929
- uses: actions/checkout@v3
19251930
- name: Prepare The Environment
@@ -1939,8 +1944,6 @@ jobs:
19391944
- name: Run Laravel Server
19401945
run: php artisan serve --no-reload &
19411946
- name: Run Dusk Tests
1942-
env:
1943-
APP_URL: "http://127.0.0.1:8000"
19441947
run: php artisan dusk
19451948
- name: Upload Screenshots
19461949
if: failure()

0 commit comments

Comments
 (0)