-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (120 loc) · 3.89 KB
/
Copy pathci.yml
File metadata and controls
143 lines (120 loc) · 3.89 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
134
135
136
137
138
139
140
141
142
143
name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13", "3.14"]
rust-version: ["1.87", "stable", "beta", "nightly"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Rust ${{ matrix.rust-version }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
components: rustfmt, clippy
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.rust-version }}-${{ hashFiles('**/Cargo.lock') }}
- name: Create and activate virtual environment
run: |
python -m venv .venv
if [ "$RUNNER_OS" != "Windows" ]; then
echo "VIRTUAL_ENV=$PWD/.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
else
echo "VIRTUAL_ENV=$PWD\.venv" >> $GITHUB_ENV
echo "$PWD\.venv\Scripts" >> $GITHUB_PATH
fi
- name: Install maturin
run: pip install maturin
- name: Build Python package
run: maturin develop
- name: Run Python tests
run: |
python test_basic.py
python simple_example.py
- name: Run Rust tests
run: cargo test
- name: Check Rust formatting
run: cargo fmt -- --check
- name: Check Rust clippy
run: cargo clippy -- -D warnings
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.8, 3.11, 3.12, 3.13, 3.14]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy
- name: Install maturin
run: pip install maturin
- name: Build wheel
run: maturin build --release
- name: List wheel files (Linux/macOS)
if: runner.os != 'Windows'
run: |
echo "Looking for wheel files in target/wheels/"
ls -la target/wheels/ || echo "target/wheels/ directory not found"
find target -name "*.whl" -type f || echo "No .whl files found"
- name: List wheel files (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
echo Looking for wheel files in target/wheels/
dir target\wheels\ 2>nul || echo target/wheels/ directory not found
dir target\*.whl /s 2>nul || echo No .whl files found
- name: Test wheel installation (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
# Find and install the wheel file
WHEEL_FILE=$(find target -name "*.whl" -type f | head -1)
if [ -n "$WHEEL_FILE" ]; then
echo "Installing wheel: $WHEEL_FILE"
pip install "$WHEEL_FILE"
python -c "import hashsig_py; print('Import successful')"
else
echo "No wheel file found"
echo "Contents of target directory:"
find target -type f || echo "target directory not found"
exit 1
fi
- name: Test wheel installation (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
for /r target %%i in (*.whl) do (
echo Installing wheel: %%i
pip install "%%i"
python -c "import hashsig_py; print('Import successful')"
goto :success
)
echo No wheel file found
dir target /s
exit /b 1
:success