name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
jobs:
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Check out markdoc-pdf
uses: actions/checkout@v5
with:
path: markdoc-pdf
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
# fonts-liberation: the per-element font tests need two distinct
# installed families to tell elements apart. macOS and Windows
# ship suitable ones; don't rely on the Linux runner's defaults.
sudo apt-get install -y libfontconfig1-dev fonts-liberation
- name: Cargo cache
uses: Swatinem/rust-cache@v2
with:
workspaces: markdoc-pdf
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: check.sh
shell: bash
run: bash markdoc-pdf/.github/scripts/check.sh markdoc-pdf
windows-arm64:
name: Windows on ARM64
runs-on: windows-11-arm
steps:
- name: Check out markdoc-pdf
uses: actions/checkout@v5
with:
path: markdoc-pdf
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cargo cache
uses: Swatinem/rust-cache@v2
with:
workspaces: markdoc-pdf
key: windows-arm64
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: cargo test
working-directory: markdoc-pdf
run: cargo test --all-targets
- name: Release build, the C runtime linked in
shell: bash
working-directory: markdoc-pdf
env:
RUSTFLAGS: -C target-feature=+crt-static
run: cargo build --release --target aarch64-pc-windows-msvc --bin markdoc-pdf --features mermaid
- name: It needs no Visual C++ runtime, and it renders
shell: bash
working-directory: markdoc-pdf
run: |
set -eu
exe=target/aarch64-pc-windows-msvc/release/markdoc-pdf.exe
if grep -a -q -i 'vcruntime140' "$exe"; then
echo "::error::$exe imports the Visual C++ runtime (vcruntime140.dll)" >&2
exit 1
fi
echo "$exe: $(wc -c < "$exe") bytes, the C runtime linked in"
"$exe" --version
"$exe" --input examples/rich.mdoc --output rich-arm64.pdf \
--style examples/themes/letter.style.toml --assets-root examples
test -s rich-arm64.pdf