-
Notifications
You must be signed in to change notification settings - Fork 10
107 lines (95 loc) · 3.02 KB
/
uns_graphdb-app.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# 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 Graph DB MQTT Client
on:
push:
branches:
- "**"
paths:
- "02_mqtt-cluster/**/*.py*"
- "02_mqtt-cluster/pyproject.toml"
- "02_mqtt-cluster/poetry.lock"
- "03_uns_graphdb/**/*.py"
- "03_uns_graphdb/pyproject.toml"
- "03_uns_graphdb/poetry.lock"
- "03_uns_graphdb/Dockerfile"
- ".github/workflows/uns_graphdb-app.yml"
- ".github/include/**"
pull_request:
branches:
- "**"
paths:
- "02_mqtt-cluster/**/*.py*"
- "02_mqtt-cluster/pyproject.toml"
- "02_mqtt-cluster/poetry.lock"
- "03_uns_graphdb/**/*.py"
- "03_uns_graphdb/pyproject.toml"
- "03_uns_graphdb/poetry.lock"
- "03_uns_graphdb/Dockerfile"
- ".github/workflows/uns_graphdb-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:
neo4j_pwd: ${{ steps.random_strings.outputs.neo4j_pwd}}
steps:
- id: random_strings
run: |
echo "neo4j_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_graphdb__url: "bolt://localhost:7687"
UNS_graphdb__username: "neo4j"
UNS_graphdb__password: ${{ needs.generate_random_password.outputs.neo4j_pwd }}
services:
uns_mqtt:
image: "emqx/emqx:latest"
ports:
- "1883:1883"
- "8083:8083"
uns_graphdb:
image: "neo4j:latest"
ports:
- "7474:7474"
- "7687:7687"
env:
NEO4J_AUTH: neo4j/${{ env.UNS_graphdb__password }}
apoc.export.file.enabled: true
apoc.import.file.enabled: true
apoc.import.file.use_neo4j_config: true
NEO4J_PLUGINS: '["apoc"]'
steps:
- uses: actions/checkout@v4
- name: Setup with python environment
uses: ./.github/include/setup_python/
with:
module: 03_uns_graphdb
- name: Run all type of tests
uses: ./.github/include/execute_tests/
with:
module: 03_uns_graphdb
integration_tests: true
SAFETY_API_KEY: ${{ secrets.SAFETY_API_KEY }}
pytest_flags: ${{ inputs.pytest_add_opts }}
build_docker_image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compile and Test Dockerfile
uses: ./.github/include/test_docker_builds/
with:
module: 03_uns_graphdb
image_name: uns/graphdb