-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (96 loc) · 3.88 KB
/
run-tests.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Run tests and static checks
on:
push:
branches:
- master
pull_request:
branches:
- '*'
repository_dispatch:
types:
- run-tests-and-build-executable
jobs:
developer-install:
runs-on: [ self-hosted, etna ]
defaults:
run:
working-directory: dev_install/pytrnsys_gui
steps:
- uses: actions/checkout@v4
with:
path: dev_install/pytrnsys_gui
- uses: actions/checkout@v4
with:
repository: SPF-OST/pytrnsys
path: dev_install/pytrnsys
- name: Remove old venv
run: |
if (Test-Path -LiteralPath venv) {
Remove-Item -LiteralPath venv -Recurse
}
- name: Create virtual environment
run: py -3.12 -m venv venv
- name: Install dependencies
run: |
venv\Scripts\python -m pip install wheel
venv\Scripts\python -m pip install -r requirements/dev.txt
- name: Generate UI code from Qt Creator Studio .ui files
run: venv\Scripts\python dev-tools\generateGuiClassesFromQtCreatorStudioUiFiles.py
- name: Tag install
run: venv\Scripts\python setup.py egg_info -b dev
- name: Check that trnsysGUI can be imported
run: venv\Scripts\python -c "import trnsysGUI"
- name: Run pip-compile-multi
run: venv\Scripts\pip-compile-multi -d requirements --no-upgrade
test:
runs-on: [self-hosted, etna]
env:
PYTRNSYS_DEPENDENCY_CHANGED: ${{github.event_name == 'repository_dispatch' && github.event.client_payload.type == 'run-tests-and-build-executable'}}
steps:
- uses: actions/checkout@v4
- name: Add Inkscape to the path
run: echo "C:\CI-Progams\Inkscape\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Remove old venv
run: |
if (Test-Path -LiteralPath venv) {
Remove-Item -LiteralPath venv -Recurse
}
- name: Create virtual environment
run: py -3.12 -m venv venv
- name: Install dependencies
run: |
venv\Scripts\python -m pip install --upgrade pip
venv\Scripts\python -m pip install wheel
venv\Scripts\python -m pip install -r requirements/test.txt
- name: Generate UI code from Qt Creator Studio .ui files
run: venv\Scripts\python dev-tools/generateGuiClassesFromQtCreatorStudioUiFiles.py
- name: Static type checking with mypy
run: venv\Scripts\python dev-tools/devTools.py --type
- name: Lint with pylint
run: venv\Scripts\python dev-tools/devTools.py --lint --keep-results
- name: Syntax checking with black
run: venv\Scripts\python dev-tools/devTools.py --black --keep-results
- name: Generate class and package diagrams
run: venv\Scripts\python dev-tools/devTools.py --diagram=dot --keep-results
- name: Test with pytest
run: venv\Scripts\python dev-tools/devTools.py --unit --keep-results
- name: Post coverage report to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: test-results/coverage.lcov
- name: Upload test results and coverage reports
uses: actions/upload-artifact@v4
with:
name: test-results-and-coverage-report-windows
path: test-results
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- if: github.event_name == 'push' || env.PYTRNSYS_DEPENDENCY_CHANGED == 'true'
name: Trigger build of executable for push
uses: peter-evans/repository-dispatch@v3
with:
repository: SPF-OST/pytrnsys_gui
token: ${{ secrets.GITHUB_TOKEN }}
event-type: build-executable-push
client-payload: '{"type": "build-executable-push"}'