2021-05-15 11:27:50 +02:00
|
|
|
name: OpenSTAManager CI
|
|
|
|
|
|
|
|
on:
|
2021-05-18 09:47:34 +02:00
|
|
|
workflow_dispatch
|
2021-05-15 11:27:50 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
tests:
|
2022-02-05 14:50:54 +01:00
|
|
|
runs-on: ubuntu-18.10
|
2021-05-15 16:21:47 +02:00
|
|
|
|
2021-05-15 11:27:50 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
python-version: [3.9]
|
2021-05-15 17:16:49 +02:00
|
|
|
php-version: ['7.4']
|
2021-05-15 11:27:50 +02:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
2021-05-15 18:17:52 +02:00
|
|
|
# - name: Set up PHP ${{ matrix.php-version }}
|
|
|
|
# uses: shivammathur/setup-php@v2
|
|
|
|
# with:
|
|
|
|
# php-version: ${{ matrix.php-version }}
|
|
|
|
# extensions: zip, mbstring, pdo_mysql, mysql, dom, xsl, openssl, intl, curl, soap, gd
|
|
|
|
|
|
|
|
- name: Setup PHP
|
2021-05-15 18:32:56 +02:00
|
|
|
run: |
|
2021-05-15 19:26:42 +02:00
|
|
|
sudo apt install libapache2-mod-php7.4
|
2021-05-15 19:52:13 +02:00
|
|
|
sudo sed -i 's,^post_max_size =.*$,post_max_size = 32M,' /etc/php/7.4/apache2/php.ini
|
|
|
|
sudo sed -i 's,^upload_max_filesize =.*$,upload_max_filesize = 32M,' /etc/php/7.4/apache2/php.ini
|
2021-05-15 18:17:52 +02:00
|
|
|
|
2021-05-15 11:27:50 +02:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
2021-05-15 12:36:30 +02:00
|
|
|
python-version: ${{ matrix.python-version }}
|
2021-05-15 12:07:48 +02:00
|
|
|
|
2021-05-15 11:27:50 +02:00
|
|
|
- name: Install SeleniumBase
|
2021-05-15 12:07:48 +02:00
|
|
|
uses: actions/checkout@v2
|
2021-05-15 11:27:50 +02:00
|
|
|
with:
|
|
|
|
repository: seleniumbase/SeleniumBase
|
|
|
|
path: selenium-base
|
2021-05-15 11:54:10 +02:00
|
|
|
|
2021-05-15 11:49:37 +02:00
|
|
|
- name: Configure SeleniumBase
|
2021-05-15 11:27:50 +02:00
|
|
|
run: |
|
|
|
|
cd selenium-base
|
|
|
|
python setup.py install
|
|
|
|
|
|
|
|
- name: Install Chrome and Firefox
|
|
|
|
run: |
|
|
|
|
sudo apt install google-chrome-stable
|
|
|
|
sudo apt-get install firefox
|
|
|
|
|
|
|
|
- name: Check the console scripts interface
|
|
|
|
run: |
|
|
|
|
seleniumbase
|
|
|
|
sbase
|
|
|
|
|
|
|
|
- name: Install chromedriver and geckodriver (Firefox Webdriver)
|
|
|
|
run: |
|
|
|
|
seleniumbase install chromedriver
|
|
|
|
seleniumbase install geckodriver
|
|
|
|
|
|
|
|
- name: Make sure pytest is working
|
|
|
|
run: |
|
|
|
|
echo "def test_1(): pass" > nothing.py
|
|
|
|
pytest nothing.py
|
|
|
|
|
|
|
|
- name: Make sure nosetests is working
|
|
|
|
run: |
|
|
|
|
echo "def test_2(): pass" > nothing2.py
|
|
|
|
nosetests nothing2.py
|
|
|
|
|
|
|
|
- name: Cache Composer packages
|
|
|
|
id: composer-cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: vendor
|
|
|
|
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-php-
|
|
|
|
|
|
|
|
- name: Install Composer dependencies
|
|
|
|
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
|
|
|
|
|
|
|
- name: Use NPM and Node.js
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: '14'
|
|
|
|
- name: Install NPM and compile assets
|
|
|
|
run: |
|
|
|
|
yarn install
|
|
|
|
npm run build-OSM
|
|
|
|
|
2021-05-15 17:35:00 +02:00
|
|
|
|
|
|
|
- name: Copy OSM to www root
|
|
|
|
run: |
|
|
|
|
sudo cp -R /home/runner/work/openstamanager/openstamanager /var/www/html/
|
|
|
|
sudo chmod -R 0777 /var/www/html/openstamanager
|
|
|
|
sudo rm /var/www/html/openstamanager/.htaccess
|
|
|
|
|
2021-05-15 11:27:50 +02:00
|
|
|
- name: Check out test repository
|
2021-05-15 12:30:29 +02:00
|
|
|
uses: actions/checkout@v2
|
2021-05-15 11:27:50 +02:00
|
|
|
with:
|
|
|
|
repository: devcode-it/openstamanager-tests
|
|
|
|
path: python-tests
|
|
|
|
|
|
|
|
- name: Install Python dependencies
|
|
|
|
run: |
|
2021-05-15 16:21:47 +02:00
|
|
|
cd python-tests/
|
2021-05-15 11:27:50 +02:00
|
|
|
python -m pip install --upgrade pip
|
|
|
|
python -m pip install pytest
|
|
|
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
2021-05-15 17:06:24 +02:00
|
|
|
|
|
|
|
- name: Restart apache
|
|
|
|
run: sudo service apache2 restart
|
|
|
|
|
|
|
|
- name: Restart MySQL
|
|
|
|
run: sudo service mysql restart
|
2021-05-15 11:27:50 +02:00
|
|
|
|
|
|
|
- name: Init test configuration
|
|
|
|
run: |
|
2021-05-15 17:59:38 +02:00
|
|
|
curl http://localhost/openstamanager/
|
2021-05-15 17:53:39 +02:00
|
|
|
sudo cat /var/log/apache2/access.log
|
2021-05-15 16:21:47 +02:00
|
|
|
cd python-tests/
|
2022-02-05 14:40:45 +01:00
|
|
|
echo -ne "{\n \"login\": {\n \"password\": \"adminadmin\",\n \"username\": \"admin\"\n },\n \"database\": {\n \"host\": \"localhost\",\n \"user\": \"root\",\n \"pass\": \"root\",\n \"name\": \"osm\"\n },\n \"server\": \"http://localhost/openstamanager/\",\n \"browser\": \"chrome\",\n \"headless\": true\n}" > config.json
|
|
|
|
#pytest Init.py
|
2021-05-15 11:27:50 +02:00
|
|
|
|
|
|
|
- name: Execute tests
|
|
|
|
run: |
|
2021-05-15 16:21:47 +02:00
|
|
|
cd python-tests/
|
2022-02-04 21:54:16 +01:00
|
|
|
python -m unittest discover tests -p '*.py'
|