From b195deeb075c0aaf18e59687ec0dd0fc00e9f762 Mon Sep 17 00:00:00 2001 From: Andrew Yourkin Date: Sun, 17 Sep 2023 00:15:28 +0200 Subject: [PATCH] Populate .env in GitHub actions --- .github/workflows/test.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 46b6090..2717b57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -38,5 +47,4 @@ jobs: ${{ runner.os }}-buildx- - name: Run tests - run: | - scripts/run.sh test + run: scripts/run test