-
Notifications
You must be signed in to change notification settings - Fork 19
192 lines (188 loc) · 5.88 KB
/
CI.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
189
190
191
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
# black-lint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: psf/black@stable
# with:
# options: "--check"
# jupyter: true
# src: "./vl-convert-python"
#
# rust-fmt-clippy:
# runs-on: ubuntu-latest
# env:
# RUSTFLAGS: "-D warnings"
# steps:
# - name: Check out repository code
# uses: actions/checkout@v2
# - name: Install latest stable Rust toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# override: true
# components: rustfmt, clippy
# - name: Cache rust dependencies
# uses: Swatinem/rust-cache@v2
# with:
# cache-on-failure: True
# - name: Install Protoc
# uses: arduino/setup-protoc@v2
# with:
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Check cargo fmt compliance
# run: cargo fmt --all -- --check
# - name: Check no rustc warnings
# run: cargo check --tests
# - name: Check for clippy warnings
# run: cargo clippy
#
# cargo-bundle-license:
# runs-on: ubuntu-latest
# steps:
# - name: Check out repository code
# uses: actions/checkout@v2
# - name: Install latest stable Rust toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# override: true
# - name: Install cargo bundle license
# run: cargo install cargo-bundle-licenses
# - name: Check that license is up to date
# run: cargo bundle-licenses --format yaml --output CI.yaml --previous thirdparty_rust.yaml --check-previous
#
# codegen-clean:
# runs-on: ubuntu-latest
# steps:
# - name: Check out repository code
# uses: actions/checkout@v2
# - name: Install latest stable Rust toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# override: true
# components: rustfmt
# - name: Cache rust dependencies
# uses: Swatinem/rust-cache@v2
# with:
# cache-on-failure: True
# - name: Install Deno
# uses: denoland/setup-deno@v1
# with:
# deno-version: vx.x.x
# - name: Run codegen
# run: cargo run
# working-directory: vl-convert-vendor
# - name: Check that git detects to file changes
# run: git diff --exit-code
#
# vl-convert-rs-tests:
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os:
# - ubuntu-latest
# - windows-2022
# - macos-12
# steps:
# - name: Check out repository code
# uses: actions/checkout@v2
# - name: Install latest stable Rust toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# - name: Cache rust dependencies
# uses: Swatinem/rust-cache@v2
# with:
# prefix-key: "v1-rust"
# cache-on-failure: True
# - name: Install Protoc
# uses: arduino/setup-protoc@v2
# with:
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Install fonts on Linux
# if: runner.os == 'Linux'
# run: |
# echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
# sudo apt-get install ttf-mscorefonts-installer
# - name: Run tests
# # Run tests on single thread for Deno, which expects this
# run: |
# cargo test --release -- --test-threads=1
# - name: Upload test failures
# uses: actions/upload-artifact@v2
# if: always()
# with:
# name: failed-images
# path: |
# vl-convert-rs/tests/vl-specs/failed
vl-convert-python-tests:
runs-on: ${{ matrix.options[0] }}
defaults:
run:
shell: ${{ matrix.options[2] }}
strategy:
matrix:
options:
- [ubuntu-latest, '3.10', 'bash -l {0}']
- [windows-2022, '3.10', "pwsh"]
- [macos-12, '3.10', 'bash -l {0}']
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install latest stable Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Cache rust dependencies
uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust"
cache-on-failure: True
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install fonts on Linux
if: runner.os == 'Linux'
run: |
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
sudo apt-get install ttf-mscorefonts-installer
- name: Display rust version
run: |
rustc --version
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.options[1] }}
cache: 'pip'
- name: Create Python Environment (Not Windows)
if: runner.os != 'Windows'
run: |
python -m venv venv
source venv/bin/activate
pip install pytest maturin scikit-image pypdfium2
maturin develop --release -m vl-convert-python/Cargo.toml
- name: Create Python Environment (Windows)
if: runner.os == 'Windows'
run: |
python -m venv venv
venv\Scripts\activate
pip install pytest maturin scikit-image pypdfium2
maturin develop --release -m vl-convert-python/Cargo.toml
- name: Run tests (Not Windows)
if: runner.os != 'Windows'
run: |
source venv/bin/activate
pytest vl-convert-python/tests/
- name: Run tests (Windows)
if: runner.os == 'Windows'
run: |
venv\Scripts\activate
pytest vl-convert-python/tests/