Skip to content

Merge pull request #16 from Som-Energia/FIX_create_irtranslation #170

Merge pull request #16 from Som-Energia/FIX_create_irtranslation

Merge pull request #16 from Som-Energia/FIX_create_irtranslation #170

name: UI-QMAKO API
on:
pull_request:
push:
workflow_dispatch:
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: pwd
UIQMAKO_TEST_ERP: 1
ERP_HOST: ${{ secrets.ERP_HOST }}
ERP_PORT: ${{ secrets.ERP_PORT }}
ERP_USER: ${{ secrets.ERP_USER }}
ERP_PASS: ${{ secrets.ERP_PASS }}
VPNADDR: ${{ secrets.VPNADDR }}
VPNHASH: ${{ secrets.VPNHASH }}
VPNUSER: ${{ secrets.VPNUSER }}
VPNPASS: ${{ secrets.VPNPASS }}
jobs:
build:
runs-on: ubuntu-latest
strategy:
# You can use PyPy versions in python-version.
# For example, pypy2 and pypy3
fail-fast: false
matrix:
python-version: [ "3.8" ]
services:
postgres:
image: postgres
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: pwd
POSTGRES_DB: test_uiqmako
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
erptesting:
image: soarinferret/fortiproxy
ports:
- 18069:18069
env:
VPNADDR: ${{ env.VPNADDR }}
VPNHASH: ${{ env.VPNHASH }}
VPNUSER: ${{ env.VPNUSER }}
VPNPASS: ${{ env.VPNPASS }}
HOSTIP: ${{ env.ERP_HOST }}
options: >-
--privileged
--name erptesting
--health-cmd "ping -q -c1 $HOSTIP"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install dependencies
run: |
poetry install
- name: Run Tests
run: |
cp tests/.env.test.example tests/.env.test
cat >> tests/.env.test <<EOF
DB_CONFIG = '{
"NAME": "test_uiqmako",
"HOST": "0.0.0.0",
"PORT": "5432",
"USER": "$POSTGRES_USER",
"PWD": "$POSTGRES_PASSWORD"
}'
ERP_CONNECTIONS= '{
"TESTING": {
"DB_NAME": "somenergia",
"PORT": $ERP_PORT,
"URI": "http://localhost",
"USER": "$ERP_USER",
"PWD": "$ERP_PASS"
}
}'
EOF
poetry run pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=uiqmako_api tests/
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
junitxml-path: ./pytest.xml
- name: Coveralls
# As for 2022-09-01, AndreMiras has not integrated boholder fork to support pyproject.toml
#uses: AndreMiras/coveralls-python-action@develop
uses: boholder/coveralls-python-action@develop
with:
parallel: true
flag-name: Unit tests
coveralls_finish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
# As for 2022-09-01, AndreMiras has not integrated boholder fork to support pyproject.toml
#uses: AndreMiras/coveralls-python-action@develop
uses: boholder/coveralls-python-action@develop
with:
parallel-finished: true