mirror of
https://github.com/storytold/craft-libs.git
synced 2026-10-31 15:49:54 +00:00
* ci: window and ui run macOS only when started by hand macOS runners are kept for releases. Pushes and pull requests run Linux and Windows; workflow_dispatch runs all three. * ci: the other workflows run macOS only when started by hand atomic, docpath, ai-core, i18n, print, pdf, update and keymap follow window and ui: Linux and Windows on pushes and pull requests (keymap: Windows), all their platforms on workflow_dispatch.
112 lines
4.9 KiB
YAML
112 lines
4.9 KiB
YAML
name: Shared PDF
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: ["crates/pdf/**", "crates/plate-test/**", "crates/prepress/**", "crates/cms/**", "vendor/hayro*/**", "vendor/krilla/**", "scripts/test-pdf-backends.sh", "scripts/*fetch-pdf-test-fonts.py", "Cargo.toml", "Cargo.lock", ".github/workflows/pdf.yml"]
|
|
pull_request:
|
|
paths: ["crates/pdf/**", "crates/plate-test/**", "crates/prepress/**", "crates/cms/**", "vendor/hayro*/**", "vendor/krilla/**", "scripts/test-pdf-backends.sh", "scripts/*fetch-pdf-test-fonts.py", "Cargo.toml", "Cargo.lock", ".github/workflows/pdf.yml"]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: shared-pdf-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
native:
|
|
name: PDF (${{ matrix.os }})
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# macOS runners are kept for releases: macOS runs only when started by hand.
|
|
os: ${{ github.event_name == 'workflow_dispatch' && fromJSON('["ubuntu-latest","windows-latest","macos-latest"]') || fromJSON('["ubuntu-latest","windows-latest"]') }}
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
RUSTFLAGS: --cfg craft_pdf_unicode_fixtures
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
|
|
with:
|
|
components: rustfmt, clippy
|
|
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
|
|
with:
|
|
key: craft-pdf
|
|
- uses: actions/setup-python@v7
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Provision licensed PDF test fonts
|
|
shell: bash
|
|
run: |
|
|
python scripts/test-fetch-pdf-test-fonts.py
|
|
python scripts/fetch-pdf-test-fonts.py "$RUNNER_TEMP/craft-pdf-test-fonts"
|
|
echo "CRAFT_PDF_TEST_FONT_DIR=$RUNNER_TEMP/craft-pdf-test-fonts" >> "$GITHUB_ENV"
|
|
- run: cargo fmt --check
|
|
- run: cargo clippy -p craft-pdf --all-targets --all-features --locked -- -D warnings
|
|
- run: cargo test -p craft-pdf --all-features --locked
|
|
- run: cargo test --manifest-path crates/pdf/read-only-contract/Cargo.toml --locked
|
|
backends:
|
|
name: PDF vendored contracts
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
|
|
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
|
|
with:
|
|
key: craft-pdf-backends
|
|
- run: bash scripts/test-pdf-backends.sh
|
|
wasm:
|
|
name: PDF WASM runtime
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RUSTFLAGS: --cfg craft_pdf_unicode_fixtures
|
|
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER: wasm-bindgen-test-runner
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
|
|
with:
|
|
targets: wasm32-unknown-unknown
|
|
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
|
|
with:
|
|
key: craft-pdf-wasm
|
|
- uses: actions/setup-python@v7
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Provision licensed PDF test fonts
|
|
shell: bash
|
|
run: |
|
|
python scripts/test-fetch-pdf-test-fonts.py
|
|
python scripts/fetch-pdf-test-fonts.py "$RUNNER_TEMP/craft-pdf-test-fonts"
|
|
echo "CRAFT_PDF_TEST_FONT_DIR=$RUNNER_TEMP/craft-pdf-test-fonts" >> "$GITHUB_ENV"
|
|
- name: Install the matching WASM test runner
|
|
shell: bash
|
|
run: |
|
|
runner_version=$(python3 -c 'import tomllib; d=tomllib.load(open("Cargo.lock", "rb")); print(next(p["version"] for p in d["package"] if p["name"] == "wasm-bindgen"))')
|
|
cargo install wasm-bindgen-cli --version "$runner_version" --locked
|
|
- run: cargo test -p craft-pdf --all-features --locked --target wasm32-unknown-unknown
|
|
- run: cargo test --manifest-path crates/pdf/read-only-contract/Cargo.toml --locked --target wasm32-unknown-unknown
|
|
plate-test:
|
|
name: Plate tests and craft-prepress
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
|
|
with:
|
|
components: clippy
|
|
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
|
|
with:
|
|
key: craft-plate-test
|
|
- uses: actions/setup-python@v7
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Provision licensed PDF test fonts
|
|
shell: bash
|
|
run: |
|
|
python scripts/test-fetch-pdf-test-fonts.py
|
|
python scripts/fetch-pdf-test-fonts.py "$RUNNER_TEMP/craft-pdf-test-fonts"
|
|
echo "CRAFT_PDF_TEST_FONT_DIR=$RUNNER_TEMP/craft-pdf-test-fonts" >> "$GITHUB_ENV"
|
|
- run: cargo clippy -p craft-plate-test -p craft-prepress --all-targets --all-features --locked -- -D warnings
|
|
- run: cargo test -p craft-plate-test -p craft-prepress --all-features --locked
|