-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (147 loc) · 4.73 KB
/
cross_platform_tests.yml
File metadata and controls
175 lines (147 loc) · 4.73 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: Cross-Platform Tests
on:
push:
tags:
- 'v*.*.*' # Only trigger on tags like v1.0.0, v1.2.3
workflow_dispatch: # Allows manual triggering
# Add this section to control notification behavior
defaults:
run:
shell: bash
# Explicitly disable all notifications
env:
GITHUB_ACTIONS_SKIP_NOTIFICATIONS: true
ACTIONS_STEP_DEBUG: false
GITHUB_ACTIONS_NOTIFICATIONS: false
jobs:
build_and_test:
name: Build and test on ${{ matrix.os }} with Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # Continue with other jobs if one fails
matrix:
os: [ubuntu-22.04]
python-version: ['3.11', '3.12']
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Rust 1.88.0
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.88.0
- name: Verify Rust version
run: rustc --version
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
id: setup_python
with:
python-version: ${{ matrix.python-version }}
# Cache Python packages
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
# Cache Rust dependencies
- name: Cache Cargo registry and index
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Create virtual environment
run: |
python -m venv .venv
echo "VIRTUAL_ENV=$PWD/.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev pkg-config build-essential
shell: bash
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-benchmark
if [ -f tests/requirements.txt ]; then pip install -r tests/requirements.txt; fi
shell: bash
- name: Build and install package with maturin
uses: PyO3/maturin-action@v1
with:
target: x86_64
command: develop
args: --release
sccache: 'true'
- name: Run API tests only
run: python run_tests.py --api-only
continue-on-error: true # Continue even if tests fail to get wheels
- name: Build wheel
uses: PyO3/maturin-action@v1
with:
target: x86_64
command: build
args: --release
sccache: 'true'
env:
OPENSSL_NO_VENDOR: 1
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-py${{ matrix.python-version }}
path: target/wheels/
# Create a release job that collects all wheels
collect_wheels:
name: Collect all wheels
needs: build_and_test
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: wheels
- name: Display wheel files
run: find wheels -type f -name "*.whl" | sort
shell: bash
- name: Flatten wheel structure
run: |
mkdir -p dist
find wheels -name "*.whl" -exec cp {} dist/ \;
echo "Files in dist after flattening:"
ls -la dist/
- name: Upload combined wheels
uses: actions/upload-artifact@v4
with:
name: all-wheels
path: dist/*.whl
publish_to_pypi:
name: Publish Python distributions to PyPI
needs: collect_wheels
runs-on: ubuntu-latest
environment: pypi
# Trigger on tags (releases) OR manual workflow dispatch
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
name: all-wheels
path: dist/
- name: List downloaded files
run: |
echo "Files in dist/:"
ls -la dist/
echo "Checking for .whl files specifically:"
find dist -name "*.whl" -type f
echo "Wheel file details:"
find dist -name "*.whl" -type f -exec basename {} \;
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1