In Github Actions NODE_ENV env variable should be set to "test" or "ci"? #22313
Unanswered
vkostunica
asked this question in
Questions and Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have Next.js app that loads environment variables form
.env.test
(public vars) and.env.test.local
(private vars) for running tests in my local dev environment. Those same vars for Github Actions are hardcoded intests.yml
configuration.In that project I have unit, api integration (with test database) and e2e (with database and built app for production) tests. In local environment I use Postgres inside Docker container, in Github Actions I define test db inside
yml
.Currently inside yarn script I have
NODE_ENV=test
that sets this in both local and Github Actions environments. I can see that in GA both.env.*
files are loaded and that variables are merged with variables defined inyml
and I see that vars fromyml
take precedence.Everything works fine like this but I have feeling this is not optimal solution because those two are indeed different environments. What if I at some future point change local environment and break GA. Also there can be multiple developers with different local environments plus GA environment. All this leads me to conclusion that in Github Action
NODE_ENV
should beci
and nottest
, so:NODE_ENV=ci
. And I keep those vars independent and without random merging.Do you know how this should be, did you implement this already and you have some existing example that I can look at?
Beta Was this translation helpful? Give feedback.
All reactions