-
Notifications
You must be signed in to change notification settings - Fork 3
133 lines (114 loc) · 4.33 KB
/
tests.yml
File metadata and controls
133 lines (114 loc) · 4.33 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', 'setup.py', 'pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y g++ python3-dev libomp-dev build-essential
# Print system information
echo "System information:"
uname -a
g++ --version
python3 --version
- name: Install build dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install numpy pandas
python -m pip install pytest pytest-cov
# Print installed packages
echo "Installed Python packages:"
pip list
- name: Set up compiler environment
run: |
# Get Python and NumPy include paths
PYTHON_INCLUDE=$(python3 -c 'import sysconfig; print(sysconfig.get_path("include"))')
NUMPY_INCLUDE=$(python3 -c 'import numpy; print(numpy.get_include())')
# Set up environment variables
echo "CFLAGS=-I${PYTHON_INCLUDE} -I${NUMPY_INCLUDE} -O3" >> $GITHUB_ENV
echo "CXXFLAGS=-I${PYTHON_INCLUDE} -I${NUMPY_INCLUDE} -std=c++11 -fopenmp -O3 -Wall -fPIC" >> $GITHUB_ENV
echo "LDFLAGS=-fopenmp" >> $GITHUB_ENV
echo "NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION" >> $GITHUB_ENV
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
# Print environment for debugging
echo "Python include path: ${PYTHON_INCLUDE}"
echo "NumPy include path: ${NUMPY_INCLUDE}"
echo "Checking if include directories exist:"
ls -la ${PYTHON_INCLUDE} || echo "Python include directory not found"
ls -la ${NUMPY_INCLUDE} || echo "NumPy include directory not found"
- name: Create package structure
run: |
mkdir -p utils pattern_causality/utils pattern_causality/cpp
cat > utils/__init__.py << 'EOL'
from .statespace import statespace
from .patternhashing import patternhashing
from .signaturespace import signaturespace
from .distancematrix import distancematrix
from .patternspace import patternspace
from .pastNNs import pastNNs
from .projectedNNs import projectedNNs
from .predictionY import predictionY
from .fillPCMatrix import fillPCMatrix
from .natureOfCausality import natureOfCausality
from .databank import databank
from .fcp import fcp
__all__ = [
'statespace', 'patternhashing', 'signaturespace', 'distancematrix',
'patternspace', 'pastNNs', 'projectedNNs', 'predictionY',
'fillPCMatrix', 'natureOfCausality', 'databank', 'fcp'
]
EOL
touch pattern_causality/utils/__init__.py
touch pattern_causality/cpp/__init__.py
echo "Package structure created:"
find . -type d
- name: Install package
run: |
echo "Building package in verbose mode..."
python -m pip install -v -e .
- name: List directory structure and environment
run: |
echo "Current directory structure:"
find . -type f -name "*.py" -o -name "*.cpp"
echo "Environment variables:"
env | grep -E "CFLAGS|CXXFLAGS|LDFLAGS|NPY|CC|CXX"
echo "Python and package information:"
python --version
pip list
echo "C++ source files:"
ls -la pattern_causality/cpp/
- name: Run tests
run: |
echo "Running tests with coverage..."
python -m pytest tests/ --cov=pattern_causality -v
- name: Upload coverage reports
if: success()
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
verbose: true