-
Notifications
You must be signed in to change notification settings - Fork 3
140 lines (115 loc) · 3.51 KB
/
ci.yml
File metadata and controls
140 lines (115 loc) · 3.51 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
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
jobs:
test-python-versions:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
os: [ubuntu-latest, ubuntu-22.04, ubuntu-24.04]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install bubblewrap
run: sudo apt-get update && sudo apt-get install -y bubblewrap
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Install dependencies
run: |
uv venv
source .venv/bin/activate
uv pip install -e ".[dev,test]"
- name: Run tests with coverage
run: |
source .venv/bin/activate
pytest --cov=pyisolate --cov-report=xml --cov-report=term-missing -v
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
test-linux-distros:
name: Test on ${{ matrix.container }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- container: debian:12
python-install: |
apt-get update && apt-get install -y python3 python3-pip python3-venv git curl bubblewrap
extras: "dev,test"
- container: fedora:38
python-install: |
dnf install -y python3 python3-pip git curl bubblewrap
extras: "dev,test"
- container: fedora:39
python-install: |
dnf install -y python3 python3-pip git curl bubblewrap
extras: "dev,test"
container: ${{ matrix.container }}
steps:
- name: Install Python and Git
run: ${{ matrix.python-install }}
- uses: actions/checkout@v4
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install package
run: |
$HOME/.local/bin/uv venv --python python3
. .venv/bin/activate
$HOME/.local/bin/uv pip install -e ".[${{ matrix.extras }}]"
- name: Run tests
run: |
. .venv/bin/activate
if [ "${{ matrix.extras }}" = "dev" ]; then
# Skip torch-related tests on platforms without torch support
pytest -v -k "not torch and not TestShareTorchConfiguration"
else
pytest -v
fi
lint-and-type:
name: Lint and Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Install dependencies
run: |
uv venv
source .venv/bin/activate
uv pip install -e ".[dev,test]"
- name: Run ruff check
run: |
source .venv/bin/activate
ruff check pyisolate tests
- name: Run ruff format check
run: |
source .venv/bin/activate
ruff format --check pyisolate tests
- name: Run mypy
run: |
source .venv/bin/activate
mypy pyisolate tests
- name: Run pytest
run: |
source .venv/bin/activate
pytest -q