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

View File

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