-
Notifications
You must be signed in to change notification settings - Fork 4
188 lines (168 loc) · 6.19 KB
/
test.yml
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
176
177
178
179
180
181
182
183
184
185
186
187
188
name: Test
on:
push:
branches:
- main
tags: [ "*" ]
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Rustfmt
run: cargo fmt --all -- --check
- uses: actions/setup-python@v4
with:
python-version: '3.x'
# TODO: Put ruff in pyproject.toml dev dependencies and use lockfile version
# or ruff github action
- uses: chartboost/ruff-action@v1
with:
version: 0.0.292
- uses: psf/[email protected]
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Clippy
run: cargo clippy --tests --all-features -- -D warnings
test-cargo:
name: Test Cargo
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
archive: maturin-x86_64-unknown-linux-gnu.tar.gz
- os: macos-latest
archive: maturin-x86_64-apple-darwin.tar.gz
- os: windows-latest
archive: maturin-x86_64-pc-windows-msvc.zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
# Make this the active python
- name: Install python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
cache: 'pip'
cache-dependency-path: 'requirements-test.txt'
- run: pip install pytest virtualenv
- uses: Swatinem/rust-cache@v2
# We need normal poetry as reference; Pin to a specific version since we diff against the output
- name: Install poetry
run: pipx install poetry==1.6.1
- name: cargo build
run: cargo build --release --features cli
- name: Cache popular wheels
id: cache-popular-wheels
uses: actions/cache@v3
with:
path: test-data/popular-wheels
key: cache-popular-wheels-${{ runner.os }}-${{ hashFiles('test-data/popular.txt') }}
- name: Download popular wheels
if: steps.cache-popular-wheels.outputs.cache-hit != 'true'
run: pip download -d test-data/popular-wheels -r test-data/popular.txt
- name: cargo test
run: cargo test --release --features cli
env:
RUST_LOG: monotrail=trace # For debugging ci failures
- name: pytest test/install_wheel_rs
run: pytest test/install_wheel_rs
- name: pytest test/monotrail_bin
run: pytest test/monotrail_bin
- uses: taiki-e/install-action@v2
with:
tool: hyperfine
- name: Benchmark plotly and tqdm
#if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'skip-for-slowness'
run: |
virtualenv .venv-benchmark
VIRTUAL_ENV=.venv-benchmark hyperfine -r 5 -p ".venv-benchmark/bin/pip uninstall -y plotly" \
"target/release/monotrail install test-data/popular-wheels/plotly-5.5.0-py2.py3-none-any.whl" \
".venv-benchmark/bin/pip install --no-deps test-data/popular-wheels/plotly-5.5.0-py2.py3-none-any.whl"
VIRTUAL_ENV=.venv-benchmark hyperfine -p ".venv-benchmark/bin/pip uninstall -y tqdm" \
"target/release/monotrail install test-data/popular-wheels/tqdm-4.62.3-py2.py3-none-any.whl" \
".venv-benchmark/bin/pip install --no-deps test-data/popular-wheels/tqdm-4.62.3-py2.py3-none-any.whl"
#VIRTUAL_ENV=.venv-benchmark hyperfine -r 5 -p ".venv-benchmark/bin/pip uninstall -y plotly" \
# "target/release/monotrail install --no-compile wheels/plotly-5.5.0-py2.py3-none-any.whl" \
# ".venv-benchmark/bin/pip install --no-compile --no-deps wheels/plotly-5.5.0-py2.py3-none-any.whl"
rm -r .venv-benchmark
- name: Archive binary (windows)
if: matrix.os == 'windows-latest'
run: |
cd target/release
7z a ../../${{ matrix.archive }} monotrail.exe
cd -
- name: Archive binary (linux and macOS)
if: matrix.os != 'windows-latest'
run: |
cd target/release
tar czvf ../../${{ matrix.archive }} monotrail
cd -
- name: Upload Binary
uses: actions/upload-artifact@v3
with:
name: binaries
path: ${{ matrix.archive }}
upload-binaries:
name: Upload Binaries
runs-on: ubuntu-latest
needs: [ test-cargo ]
steps:
- uses: actions/checkout@v3
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: binaries
path: binaries
- name: Deploy to github pages
if: ${{ github.event_name != 'pull_request' }}
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: binaries
target-folder: ${{ github.ref_name }}
test-maturin:
name: Test Maturin
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
# Make this the active python
- name: Install python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
cache: 'pip'
cache-dependency-path: 'requirements-test.txt'
- name: Install virtualenv requirements-test.txt
run: pip install -r requirements-test.txt
- uses: dtolnay/rust-toolchain@stable
# We need normal poetry as reference; Pin to a specific version since we diff against the output
- name: Install poetry
run: pipx install poetry==1.6.1
# For some reason, alternating between maturin and cargo invalidates the cache
- name: Cache maturin build
uses: Swatinem/rust-cache@v2
with:
workspaces: ". -> target-maturin"
cache-on-failure: true
# The whole venv management is overly complex
- name: make paper
if: matrix.os != 'windows-latest' # TODO
run: python make_paper.py
- name: pip install pytest
if: matrix.os != 'windows-latest'
run: .venv/bin/pip install pytest jupyter nbconvert
- name: pytest test/python
if: matrix.os != 'windows-latest'
run: .venv/bin/pytest test/python