Build and test #782
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.81.0 | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ "ubuntu-20.04", "ubuntu-22.04" ] | |
feature: [ "--no-default-features", "" ] | |
steps: | |
- uses: actions/checkout@v4 # v4 | |
- name: Cache sample slide | |
id: cache-slide | |
uses: actions/cache@v4 | |
with: | |
path: tests/data/ | |
key: slides-test | |
- name: Cache SDK | |
id: cache-sdk | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/sdk/ | |
key: cache-sdk | |
- name: Google Storage authentication | |
if: ${{ steps.cache-slide.outputs.cache-hit != 'true' || steps.cache-sdk.outputs.cache-hit != 'true' }} | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | |
export_environment_variables: true | |
create_credentials_file: true | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v2 | |
if: ${{ steps.cache-slide.outputs.cache-hit != 'true' || steps.cache-sdk.outputs.cache-hit != 'true' }} | |
- name: Download sample tests data | |
if: steps.cache-slide.outputs.cache-hit != 'true' | |
run: make dl-test-images | |
- name: Download dependencies | |
if: steps.cache-sdk.outputs.cache-hit != 'true' | |
run: make dl-sdk | |
- name: Install dependencies | |
run: make install-deps | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.os }}-${{ matrix.feature }} | |
- name: Build & Test | |
run: cargo test --workspace ${{ matrix.feature }} -- --nocapture --test-threads=1 | |
doc-rs: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 # v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: nightly | |
- name: Generate Doc | |
env: | |
DOCS_RS: 1 | |
run: cargo doc -v | |
pre-commit: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 # v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
components: clippy, rustfmt | |
- 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 |