Repository: ECSIM/gopem (language: python)

Issue:
Migrating to GitHub Actions
#### Description
Migrating from Travis/Appveyor to GitHub Actions


Discussion / hints:
@sadrasabouri Do you have any interest to handle this issue?

Fix patch:
diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/publish.yml
similarity index 100%
rename from .github/workflows/pythonpublish.yml
rename to .github/workflows/publish.yml
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index efb5701..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,104 +0,0 @@
-sudo: true
-
-language: python
-
-matrix:
-    include:
-        - os: linux
-          sudo: required
-          python: 3.8
-          dist: xenial
-          services:
-              - xvfb
-              
-        - os: linux
-          sudo: required
-          python: 3.7
-          dist: xenial
-          services:
-              - xvfb
-
-        - os: linux
-          sudo: required
-          python: 3.6
-          dist: xenial
-          services:
-              - xvfb
-
-        - os: linux
-          sudo: required
-          python: 3.5
-          dist: xenial
-          services:
-              - xvfb
-
-        - os: osx
-          language: generic
-          
-        - os: linux
-          python: 3.7-dev
-          dist: xenial
-          services:
-              - xvfb
-        - os: linux
-          python: 3.8-dev
-          dist: xenial
-          services:
-              - xvfb
-        - os: linux
-          python: nightly
-          dist: xenial
-          services:
-              - xvfb
-    allow_failures:
-        - os: linux
-          sudo: required
-          python: 3.5
-          dist: xenial
-          services:
-              - xvfb
-        - os: linux
-          python: nightly
-          dist: xenial
-          services:
-              - xvfb
-
-addons:
-  apt:
-    packages: &BASE_PACKAGES
-      - libnotify-bin
-      - libcairo2-dev
-      - gir1.2-gtk-3.0
-      - libpango1.0-dev
-      - libxcb-xtest0-dev
-      - libxcb-icccm4-dev
-      - libxcb-randr0-dev
-      - libxcb-keysyms1-dev
-      - libxcb-xinerama0-dev
-      - libdbus-1-dev
-      - libxdg-basedir-dev
-      - libstartup-notification0-dev
-      - imagemagick
-      - libxcb1-dev
-      - libxcb-shape0-dev
-      - libxcb-util0-dev
-      - libx11-xcb-dev
-      - libxcb-cursor-dev
-      - libxcb-xkb-dev
-      - libxcb-xfixes0-dev
-      - libxkbcommon-dev
-      - libxkbcommon-x11-dev
-
-install:
-  - chmod +x .travis/install.sh
-  - .travis/install.sh
-
-before_script:
-  - chmod +x .travis/test.sh
-  - "export DISPLAY=:99.0"
-  - "export QT_DEBUG_PLUGINS=1"
-  - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then ( sudo Xvfb :99 -ac -screen 0 1024x768x8; echo ok )& fi
-  - sleep 5 # give xvfb some time to start
-
-script:
-  - .travis/test.sh
diff --git a/.travis/install.sh b/.travis/install.sh
deleted file mode 100644
index a4fdb7d..0000000
--- a/.travis/install.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-# Dump Environment (so that we can check PATH, UT_FLAGS, etc.)
- set -e
- set -x
- PYTHON_COMMAND=python
- PIP_COMMAND=pip
- if [ "$TRAVIS_OS_NAME" == "osx" ]
- then
-	 PYTHON_COMMAND=python3
-	 PIP_COMMAND=pip3
- fi
- $PIP_COMMAND install -U pip 
- $PIP_COMMAND install -r requirements.txt
- $PYTHON_COMMAND setup.py install
- $PYTHON_COMMAND -m gopem --test
-  
- if [ "$TRAVIS_OS_NAME" == "osx" ]
- then
-	$PIP_COMMAND install --upgrade --upgrade-strategy=only-if-needed -r dev-requirements.txt --user
-  else
-	$PIP_COMMAND install --upgrade --upgrade-strategy=only-if-needed -r dev-requirements.txt
- fi
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cded621..0d57660 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
 and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
 
 ## [Unreleased]
+### Changed
+- Test system modified
 ## [0.6] - 2020-03-16
 ### Added
 - `__version__` variable
diff --git a/README.md b/README.md
index 4726318..606aec1 100644
--- a/README.md
+++ b/README.md
@@ -34,14 +34,9 @@ GOPEM is a graphical user interface of [OPEM (Open Source PEM Fuel Cell Simulati
 		<td align="center">develop</td>	
 	</tr>
 	<tr>
-		<td align="center">Travis</td>
-		<td align="center"><a href="https://travis-ci.org/ECSIM/gopem"><img src="https://travis-ci.org/ECSIM/gopem.svg?branch=master"></a></td>
-		<td align="center"><a href="https://travis-ci.org/ECSIM/gopem"><img src="https://travis-ci.org/ECSIM/gopem.svg?branch=develop"></a></td>
-	</tr>
-	<tr>
-		<td align="center">AppVeyor</td>
-		<td align="center"><a href="https://ci.appveyor.com/project/sepandhaghighi/gopem"><img src="https://ci.appveyor.com/api/projects/status/2765bl1ne9cy1j4o/branch/master?svg=true"></a></td>
-		<td align="center"><a href="https://ci.appveyor.com/project/sepandhaghighi/gopem"><img src="https://ci.appveyor.com/api/projects/status/2765bl1ne9cy1j4o/branch/develop?svg=true"></a></td>
+		<td align="center">CI</td>
+		<td align="center"><img src="https://github.com/ECSIM/gopem/workflows/CI/badge.svg?branch=master"></td>
+		<td align="center"><img src="https://github.com/ECSIM/gopem/workflows/CI/badge.svg?branch=develop"></td>
 	</tr>
 </table>
 
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 3b7ab01..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-build: false
-
-environment:
-  matrix:	
-  - PYTHON: "C:\\Python36"
-    PYTHON_VERSION: "3.6.0"
-    PYTHON_ARCH: "64"
-    
-  - PYTHON: "C:\\Python36"
-    PYTHON_VERSION: "3.6.0"
-    PYTHON_ARCH: "32"
-    
-  - PYTHON: "C:\\Python37"
-    PYTHON_VERSION: "3.7.0"
-    PYTHON_ARCH: "64"
-      
-  - PYTHON: "C:\\Python37"
-    PYTHON_VERSION: "3.7.0"
-    PYTHON_ARCH: "32"
-
-  - PYTHON: "C:\\Python38"
-    PYTHON_VERSION: "3.8.0"
-    PYTHON_ARCH: "64"
-
-  - PYTHON: "C:\\Python38"
-    PYTHON_VERSION: "3.8.0"
-    PYTHON_ARCH: "32"
-
-init:
-  - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"
-
-install:
-  - "%PYTHON%/Scripts/pip.exe install -r requirements.txt"
-  - "%PYTHON%/python.exe setup.py install"
-  - "%PYTHON%/python.exe -m gopem --test"
-  - "%PYTHON%/Scripts/pip.exe install -r dev-requirements.txt"
-  - "%PYTHON%/python.exe -m gopem --test"
-  - "%PYTHON%/python.exe rsrc/version_check.py"
diff --git a/rsrc/requirements-splitter.py b/rsrc/requirements-splitter.py
new file mode 100644
index 0000000..4d095bb
--- /dev/null
+++ b/rsrc/requirements-splitter.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+"""Requirements splitter."""
+
+test_req = ""
+
+with open('dev-requirements.txt', 'r') as f:
+    for line in f:
+        if '==' not in line:
+            test_req += line
+
+with open('test-requirements.txt', 'w') as f:
+    f.write(test_req)


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..19765d7
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,64 @@
+# This workflow will install Python dependencies, run tests with a variety of Python versions
+# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
+
+name: CI
+
+on: [push, pull_request]
+
+jobs:
+  build:
+
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-latest,windows-latest]
+        python-version: [3.6, 3.7, 3.8, 3.9]
+    env:
+      DISPLAY: :99.0
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v2
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Installation
+      run: |
+        python -m pip install --upgrade pip
+        pip install -r requirements.txt
+        python setup.py install
+    - name: Setup system requirements
+      run: |
+        export QT_DEBUG_PLUGINS=1
+        sudo apt-get install xvfb libnotify-bin libcairo2-dev \
+          gir1.2-gtk-3.0 libpango1.0-dev libxcb-xtest0-dev \
+          libxcb-icccm4-dev libxcb-randr0-dev libxcb-keysyms1-dev \
+          libxcb-xinerama0-dev libdbus-1-dev libxdg-basedir-dev \
+          libstartup-notification0-dev imagemagick libxcb1-dev \
+          libxcb-shape0-dev libxcb-util0-dev libx11-xcb-dev \
+          libxcb-cursor-dev libxcb-xkb-dev libxcb-xfixes0-dev \
+          libxkbcommon-dev libxkbcommon-x11-dev libxkbcommon-x11-0
+      if: matrix.os == 'ubuntu-latest'
+    - name: Test (Ubuntu)
+      run: |
+        xvfb-run python -m gopem --test
+      if: matrix.os == 'ubuntu-latest'
+    - name: Test (Windows)
+      run: |
+        python -m gopem --test
+      if: matrix.os != 'ubuntu-latest'
+    - name: Other tests requirements Installation
+      run: |
+        python rsrc/requirements-splitter.py
+        pip install --upgrade --upgrade-strategy=only-if-needed -r test-requirements.txt
+      if: matrix.python-version == 3.7
+    - name: Version check
+      run: |
+        python rsrc/version_check.py
+      if: matrix.python-version == 3.7
+    - name: Other tests
+      run: |
+          python -m vulture --min-confidence 65 --sort-by-size gopem rsrc setup.py
+          python -m bandit -r gopem
+          python -m pydocstyle -v --match-dir=gopem
+      if: matrix.python-version == 3.7
diff --git a/.travis/test.sh b/.travis/test.sh
deleted file mode 100644
index 13e1490..0000000
--- a/.travis/test.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-# Dump Environment (so that we can check PATH, UT_FLAGS, etc.)
- set -e
- set -x
- IS_IN_TRAVIS=false
- PYTHON_COMMAND=python
-  
- if [ "$TRAVIS_OS_NAME" == "osx" ]
- then
-	PYTHON_COMMAND=python3
- fi
- 
- if [ "$CI" = 'true' ] && [ "$TRAVIS" = 'true' ]
- then
-      IS_IN_TRAVIS=true
- fi
- $PYTHON_COMMAND -m gopem --test
- if [ "$IS_IN_TRAVIS" = 'false' ] || [ "$TRAVIS_PYTHON_VERSION" = '3.6' ]
- then
-     $PYTHON_COMMAND -m vulture --min-confidence 65 --sort-by-size gopem rsrc setup.py
-	 $PYTHON_COMMAND -m bandit -r gopem
-	 $PYTHON_COMMAND rsrc/version_check.py
-	 $PYTHON_COMMAND -m pydocstyle
- fi
\ No newline at end of file