Skip to content

Commit

Permalink
Populate .env in GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
yourkin committed Sep 16, 2023
1 parent 85f0cf0 commit b195dee
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,35 @@ jobs:
test:
runs-on: ubuntu-latest
env:
PG_USER: excercise_user
PG_PASSWORD: excercise_password
PG_DB: excercise_db
POSTGRES_USER: ex_back_user
POSTGRES_PASSWORD: ex_back_password
PG_DB: ex_back_db
PG_HOST: db
PG_PORT: 5432
TEST_DB: excercise_test_db
TEST_DB: ex_back_test_db
RABBIT_MQ_URL: amqp://guest:guest@localhost:5672/
CELERY_BROKER_URL: amqp://guest:guest@localhost:5672/
ENVIRONMENT: production

steps:
- name: Set up derived env variables
run: echo "TEST_DATABASE_URL=postgresql+asyncpg://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/${TEST_DB}" >> $GITHUB_ENV

- name: Checkout code
uses: actions/checkout@v3

- name: Create .env
run: touch .env

- name: Write to .env
run: |
echo "POSTGRES_USER=${{ env.POSTGRES_USER }}" >> .env
echo "POSTGRES_PASSWORD=${{ env.POSTGRES_PASSWORD }}" >> .env
echo "PG_DB=${{ env.PG_DB }}" >> .env
echo "PG_HOST=${{ env.PG_HOST }}" >> .env
echo "PG_PORT=${{ env.PG_PORT }}" >> .env
echo "TEST_DB=${{ env.TEST_DB }}" >> .env
echo "RABBIT_MQ_URL=${{ env.RABBIT_MQ_URL }}" >> .env
echo "CELERY_BROKER_URL=${{ env.CELERY_BROKER_URL }}" >> .env
echo "ENVIRONMENT=${{ env.ENVIRONMENT }}" >> .env
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

Expand All @@ -38,5 +47,4 @@ jobs:
${{ runner.os }}-buildx-
- name: Run tests
run: |
scripts/run.sh test
run: scripts/run test

0 comments on commit b195dee

Please sign in to comment.