-
Notifications
You must be signed in to change notification settings - Fork 1
119 lines (104 loc) · 3.25 KB
/
Copy pathtests.yml
File metadata and controls
119 lines (104 loc) · 3.25 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
name: Tests
on:
push:
branches-ignore: ["main", "master"]
paths:
- 'pytron/**'
- 'tests/**'
- 'pyproject.toml'
pull_request:
branches: ["**"]
paths:
- 'pytron/**'
- 'tests/**'
- 'pyproject.toml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-latest, windows-latest]
python-version: ["3.11"]
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: 🚪 Check for Rust changes
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
rust_native:
- 'pytron/engines/native/**'
- 'pytron/engines/native/Cargo.toml'
rust_loader:
- 'pytron/pack/secure_loader/**'
- 'pytron/pack/secure_loader/Cargo.toml'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: 🦀 Install Rust
uses: dtolnay/rust-toolchain@stable
- name: 🕰️ Setup Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
workspaces: |
pytron/engines/native
pytron/pack/secure_loader
- name: 🐧 Install Linux System Dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y \
libcairo2-dev \
libgirepository1.0-dev \
libglib2.0-dev \
pkg-config \
python3-dev \
libwebkit2gtk-4.1-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
libxdo-dev \
libssl-dev \
libwayland-dev \
libxkbcommon-dev \
libx11-dev \
patchelf
- name: 🍎 Install macOS Dependencies
if: matrix.os == 'macos-latest'
run: |
python -m pip install pyobjc-framework-Quartz pyobjc-framework-Cocoa
# On PRs: fast cargo check to catch compile errors without a full build
- name: 🪶 Fast Rust Check (PRs only)
if: github.event_name == 'pull_request' && (steps.filter.outputs.rust_native == 'true' || steps.filter.outputs.rust_loader == 'true')
shell: bash
run: |
if [ "${{ steps.filter.outputs.rust_native }}" == "true" ]; then
cargo check --manifest-path pytron/engines/native/Cargo.toml
fi
if [ "${{ steps.filter.outputs.rust_loader }}" == "true" ]; then
cargo check --manifest-path pytron/pack/secure_loader/Cargo.toml
fi
- name: 🦾 Build Native Engine
if: steps.filter.outputs.rust_native == 'true' || github.event_name == 'push' || startsWith(github.ref, 'refs/tags/v')
env:
PYO3_PYTHON: python3
run: python pytron/engines/native/build.py
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest pytest-asyncio
- name: Run Tests
run: pytest