Skip to content

Commit 6d318ac

Browse files
committed
Add workflows for testing and lint.
1 parent 01a6b1e commit 6d318ac

14 files changed

+171
-21
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Python Integration Test
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- staging
8+
- main
9+
paths-ignore:
10+
- version
11+
pull_request:
12+
branches:
13+
- dev
14+
- staging
15+
- main
16+
paths-ignore:
17+
- version
18+
19+
jobs:
20+
test:
21+
name: Integration Tests
22+
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
python-version: ["3.9"]
27+
28+
steps:
29+
- name: Checkout
30+
if: ${{ github.event_name == 'pull_request'}}
31+
uses: actions/checkout@v3
32+
with:
33+
ref: ${{ github.head_ref }}
34+
- name: Checkout
35+
if: ${{ github.event_name == 'push'}}
36+
uses: actions/checkout@v3
37+
with:
38+
ref: ${{ github.ref_name }}
39+
- name: Install Dependencies
40+
run: |
41+
python -m pip install --upgrade pip
42+
python -m venv venv_test
43+
source venv_test/bin/activate
44+
python -m pip install -r requirements_test.txt
45+
- name: Test with pytest
46+
run: |
47+
source venv_test/bin/activate
48+
pytest ./tests/integration -vvs

.github/workflows/python-lint.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This workflow will lint all files in repo using pylint
2+
3+
name: pylint
4+
5+
on:
6+
push:
7+
branches:
8+
- dev
9+
- staging
10+
- main
11+
paths-ignore:
12+
- version
13+
pull_request:
14+
branches:
15+
- dev
16+
- staging
17+
- main
18+
paths-ignore:
19+
- version
20+
21+
jobs:
22+
lint:
23+
name: Linter
24+
runs-on: ubuntu-latest
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
python-version: ["3.9"]
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
- name: Set up Python ${{ matrix.python-version }}
34+
uses: actions/setup-python@v3
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
- name: Install Dependencies
38+
run: |
39+
git config --global url."https://${{ secrets.BOT_OSENSA_TOKEN }}@github".insteadOf ssh://git@github
40+
python -m pip install --upgrade pip
41+
python -m venv venv_test
42+
source venv_test/bin/activate
43+
python -m pip install -r requirements_test.txt
44+
- name: Analysing the code with pylint
45+
run: |
46+
source venv_test/bin/activate
47+
pylint $(git ls-files '*.py')
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: PyTest Unit Test
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- staging
8+
- main
9+
paths-ignore:
10+
- version
11+
pull_request:
12+
branches:
13+
- dev
14+
- staging
15+
- main
16+
paths-ignore:
17+
- version
18+
19+
jobs:
20+
test:
21+
name: Unit Tests
22+
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
python-version: ["3.9"]
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v3
31+
- name: Set up Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v3
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
- name: Install Dependencies
36+
run: |
37+
git config --global url."https://${{ secrets.BOT_OSENSA_TOKEN }}@github".insteadOf ssh://git@github
38+
python -m pip install --upgrade pip
39+
python -m venv venv_test
40+
source venv_test/bin/activate
41+
python -m pip install -r requirements_test.txt
42+
- name: Test with pytest
43+
run: |
44+
source venv_test/bin/activate
45+
pytest ./tests/unit -vvs

client_rpc_channel/client_rpc_channel.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
"""Client to use for integration tests"""
21
import logging
32
from google.protobuf import service
43
import zmq

client_services/adc/client_adc_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"""
44
import logging
55
from edgepirpc.protos import adc_pb2 as adc_pb
6-
from client.client_rpc_channel.client_rpc_channel import ClientRpcChannel
7-
from client.util.helpers import (
6+
from client_rpc_channel.client_rpc_channel import ClientRpcChannel
7+
from util.helpers import (
88
filter_arg_values, create_config_request_from_args, get_server_response
99
)
10-
from client.client_services.adc.adc_pb_enums import (
10+
from client_services.adc.adc_pb_enums import (
1111
AnalogIn, ConvMode, ADC1DataRate, ADC2DataRate, FilterMode, ADCNum, DiffMode
1212
)
1313

client_services/dac/client_dac_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
serialize/deserialize messages
44
"""
55
from edgepirpc.protos import dac_pb2 as dac_pb
6-
from client.client_rpc_channel.client_rpc_channel import ClientRpcChannel
7-
from client.client_services.dac.dac_pb_enums import DACChannel
8-
from client.util.helpers import get_server_response
6+
from client_rpc_channel.client_rpc_channel import ClientRpcChannel
7+
from client_services.dac.dac_pb_enums import DACChannel
8+
from util.helpers import get_server_response
99

1010
# pylint: disable=no-member
1111
class ClientDacService():

client_services/din/client_din_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
serialize/deserialize messages
44
"""
55
from edgepirpc.protos import din_pb2 as din_pb
6-
from client.client_rpc_channel.client_rpc_channel import ClientRpcChannel
7-
from client.client_services.din.din_pb_enums import DinPins
8-
from client.util.helpers import get_server_response
6+
from client_rpc_channel.client_rpc_channel import ClientRpcChannel
7+
from client_services.din.din_pb_enums import DinPins
8+
from util.helpers import get_server_response
99

1010
# pylint: disable=no-member
1111
# pylint: disable=too-few-public-methods

client_services/dout/client_dout_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
serialize/deserialize messages
44
"""
55
from edgepirpc.protos import dout_pb2 as dout_pb
6-
from client.client_rpc_channel.client_rpc_channel import ClientRpcChannel
7-
from client.client_services.dout.dout_pb_enums import DoutPins, DoutTriState
8-
from client.util.helpers import get_server_response
6+
from client_rpc_channel.client_rpc_channel import ClientRpcChannel
7+
from client_services.dout.dout_pb_enums import DoutPins, DoutTriState
8+
from util.helpers import get_server_response
99

1010
# pylint: disable=no-member, too-few-public-methods
1111
class ClientDoutService():

client_services/led/client_led_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
serialize/deserialize messages
44
"""
55
from edgepirpc.protos import led_pb2 as led_pb
6-
from client.client_rpc_channel.client_rpc_channel import ClientRpcChannel
7-
from client.client_services.led.led_pb_enums import LEDPins
8-
from client.util.helpers import get_server_response
6+
from client_rpc_channel.client_rpc_channel import ClientRpcChannel
7+
from client_services.led.led_pb_enums import LEDPins
8+
from util.helpers import get_server_response
99

1010
# pylint: disable=no-member
1111
class ClientLEDService():

client_services/relay/client_relay_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Client for Relay Service
33
"""
44
from edgepirpc.protos import relay_pb2 as relay_pb
5-
from client.client_rpc_channel.client_rpc_channel import ClientRpcChannel
6-
from client.util.helpers import get_server_response
5+
from client_rpc_channel.client_rpc_channel import ClientRpcChannel
6+
from util.helpers import get_server_response
77

88

99
# pylint: disable=no-member

0 commit comments

Comments
 (0)