Repository navigation
104 lines (90 loc) · 3.5 KB
/
Copy pathpythonUnitTest.yml
File metadata and controls
104 lines (90 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Run UnitTest
on:
push:
paths:
- 'installer.sh'
- 'fastHistory/**'
- 'pip/**'
jobs:
build:
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-latest, macos-latest]
python-version: [3.8]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Check environment and install dependences
run: |
python3 --version
pip3 --version
pip3 install setuptools
pip3 install wheel
pip3 install twine
pip3 install bashlex
pip3 install pyperclip
pip3 install coverage
if [[ "$OSTYPE" == "linux-gnu" ]]; then
echo "OS: Linux"
sudo apt-get --yes install net-tools nmap # needed for the man parser in UnitTest
# sudo apt-get --yes install xclip # needed for pyperclip, only on Linux (more info: https://pyperclip.readthedocs.io/en/latest/index.html#not-implemented-error)
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "OS: Mac OSX"
brew install nmap
else
echo "unknown: " $OSTYPE
exit 1
fi
- name: Install with installer script
if: always()
run: |
$GITHUB_WORKSPACE/installer.sh
# this flag file is needed to run the TestMain unitTests (test_main.py)
touch $HOME/.local/share/fastHistory/THIS_IS_A_TEST_FASTHISTORY_INSTALLATION
- name: Test with UnitTest
run: |
# some of these tests need a successful installation and setup of fastHistory
path_fh=$GITHUB_WORKSPACE/
if [[ "$OSTYPE" == "linux-gnu" ]]; then
echo "OS: Linux"
# same as 'python3 -m unittest discover -s' but with test coverage
coverage run --source=$path_fh/fastHistory/ --omit=$path_fh/fastHistory/unitTests/*,$path_fh/fastHistory/pick/* -m unittest discover -s $path_fh;
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "OS: Mac OSX"
# on mac, we run only the unittest without coverage
python3 -m unittest discover -s $path_fh
else
echo "unknown: " $OSTYPE
exit 1
fi
- name: Read Coverage report
run: |
if [[ "$OSTYPE" == "linux-gnu" ]]; then
coverage report -m
else
echo "no coverage report for not linux OSs"
fi
- name: Read UnitTest output logs
if: always()
run: |
for i in $GITHUB_WORKSPACE/data_test/*.txt; do printf "\n\n## $i ## \n\n" ; cat "$i"; printf "\n" ; done ;
- name: Update with installer script and uninstall it
run: |
cd $(mktemp -d /tmp/f.XXXXX) && wget -O f mkcn.me/f?pythonUnitTest && tar -xvzf f && cd fastHistory-* && ./installer.sh
$HOME/.local/bin/f --version --from-installer
$GITHUB_WORKSPACE/installer.sh -u --yes-delete-everything
- name: Build whl package
run: |
cd $GITHUB_WORKSPACE/pip/
python3 setup.py bdist_wheel
- name: Test installation from whl package
run: |
cd $HOME
pip3 install --user --no-deps --ignore-installed $GITHUB_WORKSPACE/pip/dist/fastHistory-*.whl
$HOME/.local/bin/f --setup
$HOME/.local/bin/f --version --from-installer
$GITHUB_WORKSPACE/installer.sh -u --yes-delete-everything