Build and test #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test | |
on: | |
schedule: | |
- cron: "0 0 * * 1,5" | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_VERSION: 1.72.1 | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ "ubuntu-22.04", "ubuntu-20.04", "macos-12" ] | |
feature: [ "--no-default-features", "--features deepzoom", "--features image" ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
components: clippy, rustfmt | |
- name: Cache sample slide | |
id: cache-slide | |
uses: actions/cache@v3 | |
with: | |
path: tests/assets/ | |
key: slides-test | |
- name: Download sample tests data | |
if: steps.cache-slide.outputs.cache-hit != 'true' | |
run: make dl-test-images | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.os }}-${{ matrix.feature }} | |
- name: Install dependencies ubuntu | |
if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' }} | |
run: make install-deps-apt | |
- name: Install dependencies macos | |
if: ${{ matrix.os == 'macos-12' }} | |
run: make install-deps-brew | |
- name: Build & Test (Debug) | |
run: cargo test --workspace ${{ matrix.feature }} | |
- name: Build & Test (Release) | |
run: cargo test --release --workspace ${{ matrix.feature }} | |
doc-rs: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
components: clippy, rustfmt | |
- name: Install dependencies ubuntu | |
run: make install-deps-apt | |
- name: Generate Doc | |
env: | |
DOCS_RS: 1 | |
run: cargo doc -v | |
pre-commit: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
override: true | |
components: rustfmt, clippy | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install pre-commit | |
run: pip install pre-commit | |
- name: Pre-commit | |
run: | | |
pre-commit install --install-hooks | |
pre-commit run --all --show-diff-on-failure |