Skip to content

Commit 5851956

Browse files
authored
Add Python tests (#69)
* Add Python tests * Use Ccache for Python CI
1 parent 4daaa81 commit 5851956

File tree

9 files changed

+540
-571
lines changed

9 files changed

+540
-571
lines changed

.github/workflows/coverage.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ name: Coverage
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [main]
76
pull_request:
7+
paths:
8+
- '.github/workflows/coverage.yml'
9+
- 'cmake/**'
10+
- 'src/**'
11+
- 'tests/**'
12+
- 'CMakeLists.txt'
813

914
jobs:
1015
Coverage:

.github/workflows/docs.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,25 @@ jobs:
2323
- name: Requirements
2424
run: |
2525
sudo apt-get update
26-
sudo apt-get install doxygen python3-sphinx graphviz
26+
sudo apt-get install doxygen python3-sphinx graphviz ccache
27+
echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"
2728
python -m pip install --upgrade pip
2829
pip install -r docs/requirements.txt
2930
31+
- name: Cache Build
32+
id: cache-build
33+
uses: actions/cache@v3.0.11
34+
with:
35+
path: ${{ env.CACHE_PATH }}
36+
key: docs-cache
37+
restore-keys: Linux-Python-cache
38+
39+
- name: Prepare Ccache
40+
run: |
41+
ccache --max-size=1.0G
42+
ccache -V && ccache --show-config
43+
ccache --show-stats && ccache --zero-stats
44+
3045
- name: Build release docs
3146
run: |
3247
HEAD=$(git rev-parse HEAD)
@@ -54,7 +69,9 @@ jobs:
5469
cd ..
5570
5671
- name: Build ipctk
57-
run: pip install --verbose .
72+
run: |
73+
pip install --verbose .
74+
ccache --show-stats
5875
5976
- name: Build docs
6077
run: |

.github/workflows/python.yml

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,44 @@ jobs:
4646
with:
4747
python-version: ${{ matrix.python-version }}
4848

49+
- name: Install Ccache (Linux)
50+
if: runner.os == 'Linux'
51+
run: |
52+
sudo apt-get install ccache
53+
echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"
54+
55+
- name: Install Ccache (macOS)
56+
if: runner.os == 'macOS'
57+
run: |
58+
brew install ccache
59+
echo 'CACHE_PATH=~/Library/Caches/ccache' >> "$GITHUB_ENV"
60+
61+
- name: Install Ccache (Windows)
62+
if: runner.os == 'Windows'
63+
run: |
64+
choco install ccache
65+
"CACHE_PATH=${env:LOCALAPPDATA}\ccache" | Out-File -FilePath $env:GITHUB_ENV -Append
66+
67+
- name: Cache Build
68+
id: cache-build
69+
uses: actions/cache@v3.0.11
70+
with:
71+
path: ${{ env.CACHE_PATH }}
72+
key: ${{ runner.os }}-Python-cache
73+
restore-keys: ${{ runner.os }}-Release-cache
74+
75+
- name: Prepare Ccache
76+
run: |
77+
ccache --max-size=1.0G
78+
ccache -V && ccache --show-config
79+
ccache --show-stats && ccache --zero-stats
80+
4981
- name: Build and Install
50-
run: pip install --verbose .
82+
run: |
83+
pip install --verbose .
84+
ccache --show-stats
5185
52-
- name: Import Test
53-
run: python -c "import ipctk"
86+
- name: Tests
87+
run: |
88+
pip install -r python/tests/requirements.txt
89+
nose2 -v --pretty-assert -s python/tests

0 commit comments

Comments
 (0)