feat: setup CI to use .env_sample and postgres URI

This commit is contained in:
realaravinth 2022-05-11 13:14:17 +05:30
parent 1cd4ce7318
commit 95e7a74559
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
3 changed files with 19 additions and 7 deletions

View file

@ -1 +1 @@
export POSTGRES_DATABASE_URL=""
export POSTGRES_DATABASE_URL="postgres://postgres:password@localhost:5432/postgres"

View file

@ -51,6 +51,12 @@ jobs:
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: load env
run: |
source .env-sample \
&& echo "POSTGRES_DATABASE_URL=$POSTGRES_DATABASE_URL" >> $GITHUB_ENV
- uses: actions/setup-node@v2
with:
node-version: "16.x"
@ -74,7 +80,7 @@ jobs:
- name: Run migrations
run: make migrate
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/postgres
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
- name: build frontend
run: make frontend
@ -85,7 +91,7 @@ jobs:
with:
args: "-t 1200"
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/postgres
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
# GIT_HASH is dummy value. I guess build.rs is skipped in tarpaulin
# execution so this value is required for preventing meta tests from
# panicking

View file

@ -55,6 +55,12 @@ jobs:
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: load env
run: |
source .env-sample \
&& echo "POSTGRES_DATABASE_URL=$POSTGRES_DATABASE_URL" >> $GITHUB_ENV
- uses: actions/setup-node@v2
with:
node-version: '16.x'
@ -72,12 +78,12 @@ jobs:
- name: Run migrations
run: make migrate
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/postgres
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
- name: build
run: make
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/postgres
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
# - name: build frontend
# run: make frontend
@ -88,13 +94,13 @@ jobs:
- name: run tests
run: make test
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/postgres
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
- name: generate documentation
if: matrix.version == 'stable' && (github.repository == 'mCaptcha/mCaptcha')
run: make doc
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/postgres
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61 # dummy value
COMPILED_DATE: "2021-07-21"