Skip to content

Commit

Permalink
CI: Migrate to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ubruhin committed Mar 3, 2024
1 parent aa577b0 commit f0e36db
Show file tree
Hide file tree
Showing 6 changed files with 191 additions and 63 deletions.
183 changes: 183 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
name: CI
on: [push, pull_request]

env:
MAKEFLAGS: "-j8"

jobs:

linux:
name: "qt:${{ matrix.qt }} py:${{ matrix.py }} on ${{ matrix.container }}"
runs-on: ubuntu-22.04
container: "${{ matrix.container }}"
strategy:
matrix:
include:
- qt: "5.9"
py: "3.6"
container: "ubuntu:18.04"
packages: "qt5-default qttools5-dev-tools qtdeclarative5-dev qml-module-qtquick2"
nosetests: 1
- qt: "5.12"
py: "3.8"
container: "ubuntu:20.04"
packages: "qt5-default qttools5-dev-tools qtdeclarative5-dev qml-module-qtquick2"
nosetests: 1
- qt: "5.15"
py: "3.10"
container: "ubuntu:22.04"
packages: "qtbase5-dev qttools5-dev-tools qtdeclarative5-dev qml-module-qtquick2"
nosetests: 0 # Nosetest not working anymore
env:
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v2
- name: Install requirements
run: |
apt-get update
apt-get install -y --no-install-recommends \
build-essential cmake xvfb libglu1-mesa-dev \
python3 python3-pip python3-flake8 \
${{ matrix.packages }}
# Stylecheck
- name: Flake8
run: python3 -m flake8 client/funq server/funq_server

# Build & test C++ modules
- name: Build libFunq
run: |
mkdir build
cd build
cmake ../server -DBUILD_TESTS=1 -DBUILD_DISALLOW_WARNINGS=1
make
- name: Run libFunq tests
run: xvfb-run -a build/tests/libFunq/testLibFunq
- name: Run protocole tests
run: xvfb-run -a build/tests/protocole/testProtocole

# Server
- name: Install server
run: cd server && python3 setup.py develop

# Client
- name: Install client
run: cd client && python3 setup.py develop
- name: Test client
run: cd client && python3 setup.py test
if: ${{ matrix.nosetests != 0 }}

# Functional tests
- name: Build test app
run: cd tests-functionnal/funq-test-app && cmake . && make
- name: Test functional
run: cd tests-functionnal && xvfb-run -a nosetests
if: ${{ matrix.nosetests != 0}}

macos:
name: "qt:${{ matrix.qt }} on ${{ matrix.runner }}"
runs-on: "${{ matrix.runner }}"
strategy:
matrix:
include:
# Note: Nosetest doesn't work anymore with recent Python versions!
- {qt: "5", runner: "macos-12", nosetests: 0}
- {qt: "5", runner: "macos-14", nosetests: 0}
steps:
- uses: actions/checkout@v2
- name: Install requirements
run: |
brew install cmake qt@${{ matrix.qt }}
brew link --force qt@${{ matrix.qt }}
echo "$(brew --prefix qt${{ matrix.qt }})/bin" >> $GITHUB_PATH
pip3 install setuptools flake8
# Stylecheck
- name: Flake8
run: python3 -m flake8 client/funq server/funq_server

# Build & test C++ modules
- name: Build libFunq
run: |
mkdir build
cd build
cmake ../server -DBUILD_TESTS=1 -DBUILD_DISALLOW_WARNINGS=1
make
- name: Run libFunq tests
run: build/tests/libFunq/testLibFunq
- name: Run protocole tests
run: build/tests/protocole/testProtocole

# Server
- name: Install server
run: cd server && python3 setup.py develop

# Client
- name: Install client
run: cd client && python3 setup.py develop
- name: Test client
run: cd client && python3 setup.py test
if: ${{ matrix.nosetests != 0 }}

# Functional tests
- name: Build test app
run: cd tests-functionnal/funq-test-app && cmake . && make
- name: Test functional
run: cd tests-functionnal && xvfb-run -a nosetests
if: ${{ matrix.nosetests != 0}}

windows:
name: "qt:${{ matrix.qt }} on windows"
runs-on: windows-2022
strategy:
matrix:
include:
- {qt: "5.15", nosetests: 0}
env:
CMAKE_GENERATOR: "MinGW Makefiles"
CC: "D:/a/funq/Qt/Tools/mingw810_32/bin/gcc.exe"
CXX: "D:/a/funq/Qt/Tools/mingw810_32/bin/g++.exe"
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v2
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: "${{ matrix.qt }}.*"
tools: "tools_mingw,qt.tools.win32_mingw810"
arch: win32_mingw81
cache: true

# Build & test C++ modules
- name: Build libFunq
run: |
mkdir build
cd build
cmake ../server -DBUILD_TESTS=1 -DBUILD_DISALLOW_WARNINGS=1
make
# Note: The executables don't run yet, don't know why :-/
# - name: Run libFunq tests
# run: build/tests/libFunq/testLibFunq.exe
# - name: Run protocole tests
# run: build/tests/protocole/testProtocole.exe

# Server
- name: Install server
run: cd server && python3 setup.py develop

# Client
- name: Install client
run: cd client && python3 setup.py develop
- name: Test client
run: cd client && python3 setup.py test
if: ${{ matrix.nosetests != 0 }}

# Functional tests
- name: Build test app
run: cd tests-functionnal/funq-test-app && cmake . && make
- name: Test functional
run: cd tests-functionnal && xvfb-run -a nosetests
if: ${{ matrix.nosetests != 0}}
56 changes: 0 additions & 56 deletions ci/install_dependencies.sh

This file was deleted.

2 changes: 1 addition & 1 deletion client/funq/tests/test_aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# knowledge of the CeCILL v2.1 license and that you accept its terms.

from nose.tools import assert_equals, raises
from funq.aliases import HooqAliases, HooqAliasesInvalidLineError,\
from funq.aliases import HooqAliases, HooqAliasesInvalidLineError, \
HooqAliasesKeyError
from tempfile import NamedTemporaryFile
import os
Expand Down
4 changes: 2 additions & 2 deletions client/funq/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import os
import subprocess

from ConfigParser import ConfigParser, NoOptionError
from configparser import ConfigParser, NoOptionError


class ApplicationConfig(client.ApplicationConfig):
Expand All @@ -47,7 +47,7 @@ class ApplicationConfig(client.ApplicationConfig):
class GlobalOptions(object):

def __init__(self, **kwds):
for k, v in kwds.iteritems():
for k, v in kwds.items():
setattr(self, k, v)


Expand Down
5 changes: 3 additions & 2 deletions client/funq/tests/test_screenshoter.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_take_one_screenshot():
funq = FakeFunqClient()
with ScreenShoterCtx() as ctx:
ctx.take_screenshot(funq, "hello")
assert_equals(map(os.path.basename, funq.screens), ["0.png"])
assert_equals(list(map(os.path.basename, funq.screens)), ["0.png"])
assert_true("0.png: hello" in open(
os.path.join(ctx.working_folder, 'images.txt')).read())

Expand All @@ -76,7 +76,8 @@ def test_take_screenshots():

ctx.take_screenshot(funq, "thisisit")

assert_equals(map(os.path.basename, funq.screens), ["0.png", "1.png"])
assert_equals(list(map(os.path.basename, funq.screens)),
["0.png", "1.png"])
content = open(os.path.join(ctx.working_folder, 'images.txt')).read()
assert_true("0.png: hello" in content)
assert_true("1.png: thisisit" in content)
4 changes: 2 additions & 2 deletions server/funq_server/runner_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@

# Useful resources regarding DLL injection:
#
# - https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-best-practices
# - https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-best-practices # noqa: E501
# - https://blog.nettitude.com/uk/dll-injection-part-two
# - https://stackoverflow.com/questions/27332509/createremotethread-on-loadlibrary-and-get-the-hmodule-back
# - https://stackoverflow.com/questions/27332509/createremotethread-on-loadlibrary-and-get-the-hmodule-back # noqa: E501
# - https://github.com/numaru/injector

# Constants from Windows API documentation.
Expand Down

0 comments on commit f0e36db

Please sign in to comment.