-
Notifications
You must be signed in to change notification settings - Fork 11
131 lines (129 loc) · 4.65 KB
/
vision_build_tests_310.yaml
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
124
125
126
127
128
129
130
131
name: Build & Tests - VISION
on:
push:
branches:
- 'main'
- 'release/v*'
paths:
- 'gabarit/template_vision/**'
- '!*.md'
pull_request:
types: [opened, reopened, synchronize]
branches:
- 'main'
- 'release/v*'
paths:
- 'gabarit/template_vision/**'
- '!*.md'
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
build:
if: github.event_name != 'pull_request' || ! github.event.pull_request.draft
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install setuptools
python setup.py sdist bdist_wheel
cd dist
whl_files=( *.whl )
whl_file=${whl_files[0]}
pip install $whl_file
pip install flake8
- name: Lint with flake8
run: |
# Create a new temporary project
cd gabarit/template_vision
python generate_vision_project.py -n tmp_project_flake8 -p tmp_project_flake8
cd tmp_project_flake8
# Stop the build if there are Python syntax errors or undefined names
flake8 tmp_project_flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings.
flake8 tmp_project_flake8 --count --exit-zero --max-complexity=10 --ignore=E501,W503,E266,W605,C901,W292 --statistics
- name: Test generate VISION
run: python gabarit/template_vision/vision_tests/tests_setup.py
streamlit-checks:
if: github.event_name != 'pull_request' || ! github.event.pull_request.draft
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: nanasess/setup-chromedriver@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install setuptools
python setup.py sdist bdist_wheel
cd dist
whl_files=( *.whl )
whl_file=${whl_files[0]}
pip install $whl_file
- name: Start demonstrator
run: |
# Create a new temporary project
cd gabarit/template_vision
python generate_vision_project.py -n tmp_project_selenium -p tmp_project_selenium
# Copy data
cp -R vision_data/mnist_v1 tmp_project_selenium/tmp_project_selenium-data/mnist_v1
# Init project
cd tmp_project_selenium
make create-virtualenv
source venv_tmp_project_selenium/bin/activate
make init-local-env
# Train a model
cd tmp_project_selenium-scripts
python 2_training_classifier.py -d mnist_v1
# Start demonstrator (nohup)
nohup streamlit run 4_demonstrator.py --server.port=8501 > out.file &
- name: Setup Selenium and Chrome Driver
run: |
# Install Selenium
pip install selenium==4.2.0
# Set chromedriver to PATH
export PATH="/usr/local/bin:$PATH"
- name: Take a screenshot
run: |
# Export display (needed ?)
google-chrome --version
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # disable headless mode
# Take Screenshot
cd gabarit/template_vision/vision_tests
python selenium_screenshot.py -u 'http://localhost:8501' -o './demonstrator_screenshot.png'
- name: Archive screenshot for 2 days
uses: actions/upload-artifact@v4
with:
name: demonstrator_screenshot
path: gabarit/template_vision/vision_tests/demonstrator_screenshot.png
retention-days: 2
overwrite: true
- name: Test demonstrator
run: |
# Export display (needed ?)
google-chrome --version
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # disable headless mode
# Start tests
cd gabarit/template_vision/vision_tests
python selenium_tests.py -u 'http://localhost:8501' --with_trained_models