Skip to content

Commit

Permalink
test build
Browse files Browse the repository at this point in the history
  • Loading branch information
gunantos committed Aug 30, 2022
1 parent 68c5d13 commit 73cb7d5
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build

on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
createrelease:
name: Create Release
runs-on: [ubuntu-latest]
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Output Release URL File
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
- name: Save Release URL File for publish
uses: actions/upload-artifact@v1
with:
name: release_url
path: release_url.txt

build:
name: Build packages
needs: createrelease
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
TARGET: armv7-unknown-linux-musleabihf
CMD_BUILD: pyinstaller -F -c -n pc_monitoring -i resources/icon.ico cli.py
OUT_FILE_NAME: pc_monitoring.tar.gz
ASSET_MINE: application/x-gzip
REQUIRED_FILE: requirements/linux.txt
- os: windows-latest
TARGET: windows
CMD_BUILD: pyinstaller -F -c -n pc_monitoring -i resources/icon.ico cli.py
OUT_FILE_NAME: pc_monitoring.exe
ASSET_MIME: application/vnd.microsoft.portable-executable
REQUIRED_FILE: requirements/windows.txt
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ${{ matrix.REQUIRED_FILE }}
- name: Build with pyinstaller for ${{matrix.TARGET}}
run: ${{matrix.CMD_BUILD}}
- name: Load Release URL File from release job
uses: actions/download-artifact@v1
with:
name: release_url
- name: Get Release File Name & Upload URL
id: get_release_info
shell: bash
run: |
value=`cat release_url/release_url.txt`
echo ::set-output name=upload_url::$value
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./dist/${{ matrix.OUT_FILE_NAME}}
asset_name: ${{ matrix.OUT_FILE_NAME}}
asset_content_type: ${{ matrix.ASSET_MIME}}
Binary file added resources/icon.ico
Binary file not shown.
Empty file added tests/__init__.py
Empty file.
24 changes: 24 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import json
import socket

HOST = '192.168.1.243'
PORT = 65432


def toJSON(data):
return bytes(json.dumps(data), encoding="utf-8")


con = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
con.connect((HOST, PORT))
ke = 0
try:
while True:
msg = con.recv(1024).decode('utf-8')
print(msg)
ke = ke + 1
print(ke)
except (KeyboardInterrupt, SystemExit):
exit()
except:
exit()
15 changes: 15 additions & 0 deletions tests/test_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pc_monitoring.monitoring import Monitoring
import unittest
import sys
import os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../src")


class TestServer(unittest.TestCase):
def test_run(self):
cls = Monitoring()
cls.run()


if __name__ == '__main__':
unittest.main()

0 comments on commit 73cb7d5

Please # to comment.