-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (91 loc) · 3.24 KB
/
ci.yml
File metadata and controls
110 lines (91 loc) · 3.24 KB
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
108
109
110
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-analyze:
name: Build, Test, and Analyze
runs-on: ubuntu-latest
env:
SONAR_ORGANIZATION: boadadf
SONAR_PROJECT_KEY: boadadf_python-scada
steps:
# Checkout repo
- name: Checkout repository
uses: actions/checkout@v3
# Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install flake8 pytest
- name: Install project package
run: |
pip install -e .
- name: Verify package import
run: |
python - << 'PY'
import sys
print('PYTHONPATH:', sys.path)
import openscada_lite
print('openscada_lite imported from:', openscada_lite.__file__)
PY
# Set up Node.js / React
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install SCADA frontend dependencies
working-directory: ./src/openscada_lite/web/scada/static/frontend
run: npm install
- name: Build React SCADA frontend
working-directory: ./src/openscada_lite/web/scada/static/frontend
run: npm run build
- name: Install Config Editor frontend dependencies
working-directory: ./src/openscada_lite/web/config_editor/static/frontend
run: npm install
- name: Build React Config Editor frontend
working-directory: ./src/openscada_lite/web/config_editor/static/frontend
run: npm run build
- name: Install Security Editor frontend dependencies
working-directory: ./src/openscada_lite/web/security_editor/static/frontend
run: npm install
- name: Build React Security Editor frontend
working-directory: ./src/openscada_lite/web/security_editor/static/frontend
run: npm run build
# Run Python lint
- name: Run Python lint
run: flake8 .
- name: Run tests with coverage
env:
PYTHONPATH: src
run: |
pip install pytest pytest-cov
pytest --cov=src/openscada_lite --cov-report=xml
- name: Upload coverage.xml
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.xml
# SonarCloud analysis
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v2 # NOSONAR
with:
projectBaseDir: .
args: >
-Dsonar.organization=${{ env.SONAR_ORGANIZATION }}
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }}
-Dsonar.projectName=python-scada
-Dsonar.sources=src/openscada_lite
-Dsonar.python.coverage.reportPaths=coverage.xml
-Dsonar.exclusions=**/node_modules/**,**/__pycache__/**,**/.github/**,**/dist/**,src/openscada_lite/web/scada/static/frontend/**,src/openscada_lite/web/config_editor/static/frontend/**,src/openscada_lite/web/security_editor/static/frontend/**
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}