Repository: yashaka/selene (language: python)

Issue:
Github actions: put tests on github workflows
### What
Move selene tests from Travis-CI to GitHub Actions.

### Why
In case to keep the code and ci-pipelines more closer.

Before:
![image](https://user-images.githubusercontent.com/17043964/103518469-dddf9880-4e84-11eb-8907-7c98ae7b8440.png)

After:
![image](https://user-images.githubusercontent.com/17043964/103518495-e7690080-4e84-11eb-9b6b-726d90cfeb0f.png)

### ToDo
- [x] Move travis test scripts to github-actions.
- [x] Check it works fine.

Additional steps
- [x] Save test results to github artifacts.
~Save selene screenshots to github artifacts.~ (will be added in another PR)


Discussion / hints:

Fix patch:
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 66253e4b..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-dist: xenial
-
-addons:
-  firefox: "71.0"
-  chrome: "stable"
-
-language: python
-python:
-  - "3.7"
-
-before_install:
-  - chmod +x .upload_reports.sh
-
-services:
-  - xvfb
-
-install:
-  - pip install pipenv
-
-script:
-  - pipenv install --dev
-  - pipenv graph
-  - pipenv run py.test -sv --cov-config .coveragerc --cov-report html:skip-covered --cov-report term:skip-covered --cov=selene --tb=short tests/
-  - codecov
-
-after_script:
-  - "./.upload_reports.sh"
\ No newline at end of file
diff --git a/.upload_reports.sh b/.upload_reports.sh
deleted file mode 100644
index 6ad47c3c..00000000
--- a/.upload_reports.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-
-HERE="`dirname \"$0\"`"				# relative
-HERE="`( cd \"$HERE\" && pwd )`" 	# absolutized and normalized
-if [ -z "$HERE" ] ; then
-	# error; for some reason, the path is not accessible
-	# to the script (e.g. permissions re-evaled after suid)
-	exit 1  # fail
-fi
-
-ARTIFACTS_DIR="${HERE}/build/"
-ARTIFACTS_FILE=${TRAVIS_JOB_NUMBER}_log.tar.gz
-
-ls $ARTIFACTS_DIR
-echo "COMPRESSING build artifacts."
-cd $ARTIFACTS_DIR
-tar -zcvf $ARTIFACTS_FILE *
-# upload to http://transfer.sh
-echo "Check file exists"
-ls | grep $ARTIFACTS_FILE
-echo "Uploading to transfer.sh"
-curl --upload-file $ARTIFACTS_FILE https://transfer.sh/$ARTIFACTS_FILE
\ No newline at end of file


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 00000000..4fa14476
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,60 @@
+name: tests
+
+on: [push, pull_request]
+
+jobs:
+
+  test:
+    name: Test selene
+    runs-on: ubuntu-20.04
+    env:
+      DISPLAY: ":99"
+    steps:
+
+      - name: Checkout code
+        uses: actions/checkout@v2
+
+      - name: Set up Python
+        uses: actions/setup-python@v2
+        with:
+          python-version: '3.7'
+
+      # can be packaged as Docker-image
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install pipenv
+          pipenv install --dev
+          pipenv graph
+
+      # can be packaged as Docker-image
+      - name: Install Chrome & xvfb
+        run: |
+          sudo apt-get install google-chrome-stable xvfb
+          sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
+
+      - name: Test selene with pytest
+        run: |
+          pipenv run py.test -sv --cov-config .coveragerc --cov-report html:skip-covered --cov-report term:skip-covered --cov=selene  --cov-report xml:coverage.xml --tb=short tests/
+          mkdir -p Artifacts/skip-covered
+          cp -r skip-covered Artifacts/skip-covered
+
+      # can be improved by flags/options
+      - name: Code Coverage
+        uses: codecov/codecov-action@v1.1.1
+        with:
+          file: ./coverage.xml # optional
+          flags: unittests # optional
+          name: selene-codecov # optional
+          fail_ci_if_error: true # optional (default = false)
+          verbose: true
+
+      # can be organized better
+      - name: Upload pytest test results
+        uses: actions/upload-artifact@v2
+        with:
+          name: Code coverage
+          path: |
+            Artifacts
+            coverage.xml
+        if: ${{ always() }}
\ No newline at end of file