Skip to content

Bump pytest-retry from 1.6.3 to 1.7.0 in /07_uns_graphql #2637

Bump pytest-retry from 1.6.3 to 1.7.0 in /07_uns_graphql

Bump pytest-retry from 1.6.3 to 1.7.0 in /07_uns_graphql #2637

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: UNS Historian MQTT Client
on:
push:
branches:
- "**"
paths:
- "02_mqtt-cluster/**/*.py*"
- "02_mqtt-cluster/pyproject.toml"
- "02_mqtt-cluster/poetry.lock"
- "04_uns_historian/**/*.py"
- "04_uns_historian/pyproject.toml"
- "04_uns_historian/poetry.lock"
- "04_uns_historian/Dockerfile"
- ".github/workflows/uns_historian-app.yml"
- ".github/include/**"
pull_request:
branches:
- "**"
paths:
- "02_mqtt-cluster/**/*.py*"
- "02_mqtt-cluster/pyproject.toml"
- "02_mqtt-cluster/poetry.lock"
- "04_uns_historian/**/*.py"
- "04_uns_historian/pyproject.toml"
- "04_uns_historian/poetry.lock"
- "04_uns_historian/Dockerfile"
- ".github/workflows/uns_historian-app.yml"
- ".github/include/**"
workflow_dispatch:
inputs:
pytest_add_opts: # trunk-ignore(checkov/CKV_GHA_7) # trunk-ignore(checkov/CKV_GHA_7)
description: "additional pytest options"
type: string
permissions:
contents: read
jobs:
generate_random_password:
runs-on: ubuntu-latest
outputs:
postgres_pwd: ${{ steps.random_strings.outputs.postgres_pwd }}
uns_historian_pwd: ${{ steps.random_strings.outputs.uns_historian_pwd}}
steps:
- id: random_strings
run: |
echo "postgres_pwd=$(openssl rand -base64 32 | tr -dc '[:alnum:]')" >> $GITHUB_OUTPUT
echo "uns_historian_pwd=$(openssl rand -base64 32 | tr -dc '[:alnum:]')" >> $GITHUB_OUTPUT
build_code:
runs-on: ubuntu-latest
needs: generate_random_password
environment: dev
env:
UNS_mqtt__host: "localhost"
UNS_mqtt__port: 1883
UNS_historian__hostname: "localhost"
UNS_historian__database: "uns_historian"
UNS_historian__table: "unifiednamespace"
UNS_historian__username: "uns_dbuser"
UNS_historian__password: ${{ needs.generate_random_password.outputs.uns_historian_pwd }}
POSTGRES_PASSWORD: ${{ needs.generate_random_password.outputs.postgres_pwd }}
services:
uns_mqtt:
image: "emqx/emqx:latest"
ports:
- "1883:1883"
uns_timescaledb:
image: "timescale/timescaledb:latest-pg16"
ports:
- "5432:5432"
env:
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
steps:
- uses: actions/checkout@v4
- name: Setup with python environment
uses: ./.github/include/setup_python/
with:
module: 04_uns_historian
- name: Create Database for Integration Testing
env:
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
UNS_historian__password: ${{ env.UNS_historian__password }}
run: |
echo "CREATE database $UNS_historian__database;
\c $UNS_historian__database;
CREATE EXTENSION IF NOT EXISTS timescaledb;
CREATE ROLE $UNS_historian__username
LOGIN
PASSWORD '$UNS_historian__password';
ALTER DATABASE $UNS_historian__database OWNER TO $UNS_historian__username;
" | PGPASSWORD=${POSTGRES_PASSWORD} psql -h ${UNS_historian__hostname} -U postgres -p 5432
echo "CREATE TABLE $UNS_historian__table (
time TIMESTAMPTZ NOT NULL,
topic text NOT NULL,
client_id text,
mqtt_msg JSONB,
CONSTRAINT unique_event UNIQUE (time, topic, client_id, mqtt_msg)
);
SELECT create_hypertable('$UNS_historian__table', 'time');
" | PGPASSWORD=${UNS_historian__password} psql -h ${UNS_historian__hostname} -U $UNS_historian__username -d $UNS_historian__database -p 5432
- name: Run all type of tests
uses: ./.github/include/execute_tests/
with:
module: 04_uns_historian
integration_tests: true
SAFETY_API_KEY: ${{ secrets.SAFETY_API_KEY }}
pytest_flags: ${{ inputs.pytest_add_opts }}
build_docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compile and Test Dockerfile
uses: ./.github/include/test_docker_builds/
with:
module: 04_uns_historian
image_name: uns/historian