Skip to content

Commit

Permalink
#149 Disable travis and use GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinMaciaszek committed May 13, 2020
1 parent 38ae09f commit d99cda2
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 63 deletions.
104 changes: 93 additions & 11 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,112 @@ on:
push:
branches:
- '*'
pull_request:
branches:
- master

jobs:
build:

piepline:
name: Build and test rfhub2
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

strategy:
matrix:
node-version: [13.x]
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies

- name: Cache Python packages
uses: actions/cache@v1
id: cache-pip
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt', '**/requirements-postgres.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt', '**/requirements-postgres.txt') }}
- name: Install Python dependencies
if: steps.cache-pip.outputs.cache-hit != 'true'
run: |
pip install -r requirements.txt -r requirements-dev.txt -r requirements-postgres.txt
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name : Tests
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -r requirements-postgres.txt
- name : Unit tests and coverage check
run: |
python -m coverage run --source rfhub2 -m unittest tests
python -m coverage xml
- name: Black check
run: |
black --check rfhub2 tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests
fail_ci_if_error: true

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install yarn dependencies
uses: bahmutov/npm-install@v1
with:
working-directory: frontend

- uses: nanasess/setup-chromedriver@master
- run: |
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
- name: Build UI
run: ./build_ui.sh

- name: Build rfhub2 python package
run: python setup.py sdist bdist_wheel

- name: Install rfhub2 in env
run: pip install $(find dist -type f -iname "rfhub2-*.whl")[postgresql]

- name: Run default Robot tests
run: |
robot -A tests/acceptance/conf/default.args -d results/ tests/acceptance
- name: Upload default tests results
if: failure()
uses: actions/upload-artifact@v1
with:
name: Default tests
path: /home/runner/work/rfhub2/rfhub2/results/

- name: Run postgres Robot Framework tests
run: |
robot -A tests/acceptance/conf/postgres.args tests/acceptance
- name: Upload postgres tests results
if: failure()
uses: actions/upload-artifact@v1
with:
name: Postgres tests
path: /home/runner/work/rfhub2/rfhub2/log.html
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ To create frontend build and add its files to rfhub2 package static files direct
```
./build_ui.sh
```
You can specify *clean* parameter, if there is need to clean static files
```
./build_ui.sh clean
```

### Populate application with data
To populate application running on localhost:
Expand Down
7 changes: 5 additions & 2 deletions build_ui.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/bin/bash
# !!!Please use clean paramater for this bash script if you need to clean static files.!!!
pushd frontend
yarn build
popd
rm -r rfhub2/static/*
rm rfhub2/templates/index.html
if [ "$1" == "clean" ]; then
rm -r rfhub2/static/*
rm rfhub2/templates/index.html
fi
cp -r frontend/build/* rfhub2/static
mv rfhub2/static/index.html rfhub2/templates/index.html
1 change: 0 additions & 1 deletion tests/acceptance/conf/default.args
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# default arguments; any other argument files should include
# this file.
-C ansi
--variable ACTIVATE_VENV:. atests-venv/bin/activate &&
1 change: 0 additions & 1 deletion tests/acceptance/conf/postgres.args
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# default arguments; any other argument files should include
# this file.
-C ansi
--variable ACTIVATE_VENV:. atests-venv/bin/activate &&
--variable DB_URI:RFHUB_DB_URI=postgresql://postgres:postgres@localhost:5432/postgres
1 change: 0 additions & 1 deletion tests/acceptance/conf/venv_wrapper.args
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# default arguments; any other argument files should include
# this file.
-C ansi
--variable ACTIVATE_VENV:
2 changes: 1 addition & 1 deletion tests/acceptance/resources/e2e_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Library SeleniumLibrary

*** Keywords ***
Open Browser With App On Mainpage
Open Browser url=localhost:8000 browser=gc
Open Browser http://localhost:8000 Headless Chrome
Maximize Browser Window

Navigate To Main Page
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/resources/keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Start Rfhub2
... As a side effect this creates a suite variable named \${rfhub process},
... which is used by the 'Stop rfhub2' keyword.
Remove File ${DB_PATH}
${rfhub2_process} Start Process ${ACTIVATE_VENV} ${DB_URI} rfhub2
${rfhub2_process} Start Process ${DB_URI} rfhub2
... shell=True stdout=api_logs.log stderr=stderr_logs.log
Set Suite Variable ${rfhub2_process}
Wait Until Keyword Succeeds 20 seconds 0.5 second
Expand All @@ -32,15 +32,15 @@ Run Cli Package With Options
... Attempt to run the rfhub2-cli package with the given options
... The stdout of the process will be in a test suite
... variable named \${output}
${output} Run ${ACTIVATE_VENV} rfhub2-cli ${options}
${output} Run rfhub2-cli ${options}
Set Suite Variable ${output}

Run Cli Package
[Documentation]
... Attempt to run the rfhub2-cli package with the default options
... The stdout of the process will be in a test suite
... variable named \${output}
${output} Run ${ACTIVATE_VENV} rfhub2-cli
${output} Run rfhub2-cli
Set Suite Variable ${output}

Output Should Contain
Expand Down

0 comments on commit d99cda2

Please sign in to comment.