Skip to content

Update README.md

Update README.md #7

Workflow file for this run

name: CI
on:
push:
branches: [main, master]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CGO_ENABLED: "1"
jobs:
test:
name: test / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: linux-amd64
# Not ubuntu-22.04-arm: the Linux archives need glibc >= 2.38.
# See "Linux needs glibc 2.38 or newer" in README.md.
- os: ubuntu-26.04-arm
target: linux-arm64
- os: macos-latest
target: macos-arm64 # macos-latest runners are Apple silicon
- os: windows-latest
target: windows-amd64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: false
- name: Install Linux dependencies
if: runner.os == 'Linux'
# The fonts are a runtime dependency: without them the renderer produces
# blank pages and still reports success.
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libfontconfig1-dev \
fonts-liberation fonts-dejavu-core
- name: Install macOS dependencies
if: runner.os == 'macOS'
run: brew install fontconfig
- name: Check for a mingw gcc
if: runner.os == 'Windows'
shell: pwsh
run: gcc --version
- name: Show the link flags the archives expect
shell: bash
continue-on-error: true
run: |
for f in libblitz/*/native-static-libs.txt; do
[ -f "$f" ] || continue
echo "$f:"; sed 's/^/ /' "$f" || true
done
- name: go vet
run: go vet ./...
- name: Check the generated files are current
if: matrix.target == 'linux-amd64'
shell: bash
run: make check-generated
- name: Check no module is over the go command's size cap
if: matrix.target == 'linux-amd64'
shell: bash
# golang.org/x/mod/zip.MaxZipFile: the go command refuses a module whose
# zip OR extracted content exceeds 500 MiB. Files in a nested module do
# not count towards the parent, so each is measured on its own.
run: |
status=0
cap=$((500 * 1024 * 1024))
for d in . libblitz/*/; do
if [ "$d" = "." ]; then
bytes=$(git ls-files -z \
| grep -zv '^libblitz/[^/]*/' \
| xargs -0 -r stat -c %s \
| awk '{s+=$1} END {print s+0}')
else
bytes=$(git ls-files -z -- "$d" \
| xargs -0 -r stat -c %s \
| awk '{s+=$1} END {print s+0}')
fi
printf '%-28s %8.1f MiB\n' "$d" "$(echo "$bytes" | awk '{print $1/1048576}')"
if [ "$bytes" -ge "$cap" ]; then
echo "::error::$d is over the 500 MiB module limit"
status=1
fi
done
exit $status
# -race is not optional: the package pins goroutines to OS threads for the
# library's thread-local error slot, and guards the context pointer
# against a concurrent Close.
- name: go test -race
run: go test -race -v ./...
- name: Build the example command
run: go build -o bin/blitz-render ./cmd/blitz-render
- name: Render through the CLI
shell: bash
run: |
./bin/blitz-render -no-net -w 900 -o cli-markdown.png testdata/sample.md
./bin/blitz-render -no-net -w 900 -o cli-html.png testdata/sample.html
ls -l cli-*.png
- name: Check the renders are not blank
shell: bash
# Size is the cheapest proxy for "fonts actually resolved": a missing
# font stack produces a valid, nearly empty PNG.
run: |
for f in cli-markdown.png cli-html.png testdata/output/*.png; do
[ -f "$f" ] || continue
size=$(wc -c < "$f")
echo "$f: $size bytes"
if [ "$size" -lt 2048 ]; then
echo "::error::$f is suspiciously small — missing fonts?"
exit 1
fi
done
- uses: actions/upload-artifact@v4
if: always()
with:
name: renders-${{ matrix.os }}
path: |
cli-*.png
testdata/output/*.png
if-no-files-found: warn
retention-days: 7
network:
name: live render (google.com)
runs-on: ubuntu-latest
timeout-minutes: 20
# Depends on an external site that can rate-limit datacenter IPs.
# Informative, not a gate.
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libfontconfig1-dev \
fonts-liberation fonts-dejavu-core
- run: go test -race -v -network -run 'URL' ./...
- uses: actions/upload-artifact@v4
if: always()
with:
name: live-renders
path: testdata/output/*.png
if-no-files-found: warn
hygiene:
name: committed file sizes + permissions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: No file over GitHub's 100 MiB limit
shell: bash
# GitHub rejects the push outright, so this is the only way to find out
# before the archives are unpushable.
run: |
oversized=$(find . -path ./.git -prune -o -type f -size +100M -print)
if [ -n "$oversized" ]; then
echo "::error::over the 100 MiB file limit: $oversized"
ls -lh $oversized
exit 1
fi
echo "largest committed files:"
find . -path ./.git -prune -o -type f -printf '%s %p\n' \
| sort -rn | head -5 \
| awk '{ printf " %6.1f MiB %s\n", $1/1048576, $2 }'
- name: Archives are not executable
run: |
bad=$(find libblitz -name '*.a' -perm -u+x -print)
if [ -n "$bad" ]; then
echo "::error::executable bit set on: $bad (build-blitz.sh should chmod -x)"
exit 1
fi