-
Notifications
You must be signed in to change notification settings - Fork 4
98 lines (89 loc) · 3.01 KB
/
ci.yml
File metadata and controls
98 lines (89 loc) · 3.01 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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
rust-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: cargo test --lib
python-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: dtolnay/rust-toolchain@stable
- run: pip install maturin pytest
- run: python tests/fixtures/create_fixtures.py
- run: python tests/fixtures/create_edge_cases.py
- run: maturin develop
- run: pytest tests/ -v --ignore=tests/test_epubcheck.py
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: cargo fmt --all --check
- run: cargo clippy -p fast-ebook-cli -- -D warnings
- run: cargo clippy -p fast-ebook --features python -- -D warnings
epubcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- uses: dtolnay/rust-toolchain@stable
- name: Install EPUBCheck
run: |
EPUBCHECK_VERSION="5.1.0"
curl -sL "https://github.com/w3c/epubcheck/releases/download/v${EPUBCHECK_VERSION}/epubcheck-${EPUBCHECK_VERSION}.zip" -o epubcheck.zip
unzip -q epubcheck.zip
echo "EPUBCHECK_JAR=$(pwd)/epubcheck-${EPUBCHECK_VERSION}/epubcheck.jar" >> $GITHUB_ENV
- name: Build fast-ebook
run: |
pip install maturin pytest
python tests/fixtures/create_fixtures.py
python tests/fixtures/create_edge_cases.py
maturin develop
- name: Run EPUBCheck validation tests
run: pytest tests/test_epubcheck.py -v
cli:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo build -p fast-ebook-cli --release
- name: Test CLI
run: |
python tests/fixtures/create_fixtures.py
./target/release/fast-ebook --version
./target/release/fast-ebook info tests/fixtures/minimal_epub3.epub
./target/release/fast-ebook validate tests/fixtures/minimal_epub3.epub
./target/release/fast-ebook scan tests/fixtures/
./target/release/fast-ebook convert tests/fixtures/minimal_epub3.epub -o /tmp/test.md
test -s /tmp/test.md