Skip to content

Run lualatex example in sanitycheck job. #84

Run lualatex example in sanitycheck job.

Run lualatex example in sanitycheck job. #84

Workflow file for this run

# The MIT License (MIT)
#
# Copyright © 2026 The pyTooling Authors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
name: Build MiKTeX images
on:
push:
workflow_dispatch:
jobs:
Prepare:
uses: pyTooling/Actions/.github/workflows/PrepareJob.yml@r7
MiKTeX:
name: 🛳️ Build MiKTeX base-image
runs-on: 'ubuntu-24.04'
outputs:
base_image_os_version: ${{ steps.variables.outputs.base_image_os_version }}
base_image_os_codename: ${{ steps.variables.outputs.base_image_os_codename }}
base_image_py_version: ${{ steps.variables.outputs.base_image_py_version }}
miktex_source_repository: ${{ steps.variables.outputs.miktex_source_repository }}
miktex_image_ns: ${{ steps.variables.outputs.miktex_image_ns }}
miktex_image_name: ${{ steps.variables.outputs.miktex_image_name }}
miktex_image_tag: ${{ steps.variables.outputs.miktex_image_tag }}
miktex_image: ${{ steps.variables.outputs.miktex_image }}
miktex_version: ${{ steps.test.outputs.miktex_version }}
steps:
- name: 🖉 Variables
id: variables
run: |
base_image_name="python"
base_image_os_version="12"
base_image_os_codename="Bookworm"
base_image_os_size="-slim"
base_image_py_version="3.14"
miktex_source_repository="${base_image_os_codename,,}"
image_name="miktex"
image_tag="latest"
tee "${GITHUB_OUTPUT}" <<EOF
base_image_name=${base_image_name}
base_image_os_version=${base_image_os_version}
base_image_os_codename=${base_image_os_codename}
base_image_py_version=${base_image_py_version}
base_image=${base_image_name}:${base_image_py_version}${base_image_os_size}-${base_image_os_codename,,}
miktex_source_repository=${miktex_source_repository}
miktex_image_ns=${{ vars.DOCKERHUB_NAMESPACE }}
miktex_image_name=${image_name}
miktex_image_tag=${image_tag}
miktex_image=${{ vars.DOCKERHUB_NAMESPACE }}/${image_name}:${image_tag}
EOF
- name: ⏬ Checkout repository
uses: actions/checkout@v6
- name: 🐋 Building MiKTeX image
id: build
run: |
ANSI_RED=$'\x1b[31m'
ANSI_GREEN=$'\x1b[32m'
ANSI_YELLOW=$'\x1b[33m'
ANSI_BLUE=$'\x1b[34m'
ANSI_CYAN=$'\x1b[36m'
ANSI_DARK_GRAY=$'\x1b[90m'
ANSI_LIGHT_BLUE=$'\x1b[94m'
ANSI_NOCOLOR=$'\x1b[0m'
RemoveComments() {
local OutputFile="${2:-$1}"
printf "::group::${ANSI_LIGHT_BLUE}%s${ANSI_NOCOLOR}\n" "Removing comments from '$1' and writing to '${OutputFile}' ..."
grep -v '^\s*$\|^\s*\#' "$1" > "${OutputFile}"
cat "${OutputFile}" | sed 's/^/ /'
printf "::endgroup::\n"
}
DockerImageSizeUncompressed() {
docker image inspect $1 --format='{{.Size}}' | numfmt --to=iec --format '%.2f'
}
printf -- "Convert 'Base.packages' to 'Debian.packages' ...\n"
RemoveComments Base.packages Debian.packages
printf -- "Convert 'Common.packages' to 'Install.packages' ...\n"
RemoveComments Common.packages Install.packages
printf -- "Convert 'Common.list' to 'Packages.list' ...\n"
RemoveComments Common.list Packages.list
printf -- "Building docker file 'Dockerfile' ...\n"
docker buildx build \
--file Dockerfile \
--build-arg IMAGE=${{ steps.variables.outputs.base_image }} \
--build-arg MIKTEX_SRC_REPO=${{ steps.variables.outputs.miktex_source_repository }} \
--label "org.opencontainers.image.title=MiKTeX on Debian ${{ steps.variables.outputs.base_image_os_version }} (${{ steps.variables.outputs.base_image_os_codename }}) + Python ${{ steps.variables.outputs.base_image_py_version }}" \
--label "org.opencontainers.image.description=MiKTeX on Debian ${{ steps.variables.outputs.base_image_os_version }} (${{ steps.variables.outputs.base_image_os_codename }}) + Python ${{ steps.variables.outputs.base_image_py_version }} image maintained by pyTooling Authors." \
--label "org.opencontainers.image.authors=Patrick Lehmann <Paebbels@gmail.com>" \
--label "org.opencontainers.image.vendor=pyTooling" \
--label "org.opencontainers.image.version=1.0" \
--label "org.opencontainers.image.revison=${GITHUB_SHA}" \
--label "org.opencontainers.image.created=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--label "org.opencontainers.image.url=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \
--label "org.opencontainers.image.source=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" \
--label "org.opencontainers.image.documentation=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/blob/main/README.md" \
--label "org.opencontainers.image.license=MIT" \
--label "pyTooling.dockerimages.os.name=Debian" \
--label "pyTooling.dockerimages.os.version=${{ steps.variables.outputs.base_image_os_version }}" \
--label "pyTooling.dockerimages.os.codename=${{ steps.variables.outputs.base_image_os_codename }}" \
--label "pyTooling.dockerimages.os.variant=" \
--label "pyTooling.dockerimages.os.packagemanager=apt" \
--label "pyTooling.dockerimages.os.fullname=Debian ${{ steps.variables.outputs.base_image_os_version }} (${{ steps.variables.outputs.base_image_os_codename }})" \
--label "pyTooling.dockerimages.py.version=${{ steps.variables.outputs.base_image_py_version }}" \
--label "pyTooling.dockerimages.application.name=MiKTeX" \
--tag "${{ steps.variables.outputs.miktex_image }}" \
. 2>&1 \
| ./Docker.buildx.sh
# check return codes from docker incase of error.
printf -- "Docker image '%s' has %s\n" "${{ steps.variables.outputs.miktex_image }}" "$(DockerImageSizeUncompressed ${{ steps.variables.outputs.miktex_image }})"
- name: ☑ Checking MiKTeX image '${{ steps.variables.outputs.miktex_image }}'
id: test
run: |
DockerImageSizeUncompressed() {
docker image inspect $1 --format='{{.Size}}' | numfmt --to=iec --format '%.2f'
}
printf -- "Docker image '%s' has %s\n" "${{ steps.variables.outputs.miktex_image }}" "$(DockerImageSizeUncompressed ${{ steps.variables.outputs.miktex_image }})"
printf -- "Labels of '${{ steps.variables.outputs.miktex_image }}':\n"
docker inspect --format='{{json .Config.Labels}}' "${{ steps.variables.outputs.miktex_image }}" | jq
docker container run --rm ${{ steps.variables.outputs.miktex_image }} bash -c 'printf "%s\n" "which pdflatex: $(which pdflatex) ($(pdflatex --version | head -n 1))"'
MIKTEX_VERSION="$(docker container run --rm ${{ steps.variables.outputs.miktex_image }} bash -c "miktex --version | head -n 1")"
printf -- "MiKTeX version (raw): %s\n" "${MIKTEX_VERSION}"
MIKTEX_VERSION="$(echo "${MIKTEX_VERSION}" | grep -oP '\(MiKTeX \d+\.\d+\)' | grep -oP '\d+\.\d+')"
tee "${GITHUB_OUTPUT}" <<EOF
miktex_version=${MIKTEX_VERSION}
EOF
# TODO: add miktex version as label to image
- name: 🔑 Login and push '${{ steps.variables.outputs.miktex_image }}' to Docker Hub
run: |
DockerImageSizeUncompressed() {
docker image inspect $1 --format='{{.Size}}' | numfmt --to=iec --format '%.2f'
}
printf "%s\n" "Login at Docker Hub ..."
printf "%s\n" "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u ${{ vars.DOCKERHUB_USERNAME }} --password-stdin
printf -- "Docker image '%s' has %s\n" "${{ steps.variables.outputs.miktex_image }}" "$(DockerImageSizeUncompressed ${{ steps.variables.outputs.miktex_image }})"
docker image push ${{ steps.variables.outputs.miktex_image }}
SanityCheck:
name: Check MiKTeX installation
runs-on: 'ubuntu-24.04'
needs:
- MiKTeX
container:
image: ${{ needs.MiKTeX.outputs.miktex_image }}
steps:
- name: Check default shell
run: |
printf -- "Checking active shell ...\n"
activeShell=$(readlink /proc/$$/exe)
if [ "$activeShell" == "$(which bash)" ]; then
printf -- " Shell is Bash (%s - version %s) \x1b[92m[OK]\x1b[0m\n" "$activeShell" "$(/bin/bash --version | head -n 1)"
else
printf -- " Shell is %s \x1b[91m[FAILED]\x1b[0m\n" "$activeShell"
exit 1
fi
- name: Check filters
run: |
filter.latexmk.sh --help
- name: ⏬ Checkout repository
uses: actions/checkout@v6
- name: Compile 'example/document.tex'
run: |
set -o pipefail
chown -R latex:latex .
cd ./example/lualatex
pwd
ls -lAh
sudo -u latex latexmk --lualatex --interaction=nonstopmode --file-line-error --halt-on-error document.tex | filter.latexmk.sh
ls -lAh *.pdf
Specific:
name: ${{ matrix.icon }} Build specific MiKTeX image for ${{ matrix.name }}
runs-on: 'ubuntu-24.04'
needs:
- MiKTeX
strategy:
fail-fast: false
matrix:
include:
- {'icon': '📓', 'name': 'Sphinx', 'image': 'sphinx'}
steps:
- name: 🖉 Variables
id: variables
run: |
tee "${GITHUB_OUTPUT}" <<EOF
specific_image_ns="${{ needs.MiKTeX.outputs.miktex_image_ns }}"
specific_image_name="${{ needs.MiKTeX.outputs.miktex_image_name }}"
specific_image_tag="${{ matrix.name }}"
specific_image=${{ needs.MiKTeX.outputs.miktex_image_ns }}/${{ needs.MiKTeX.outputs.miktex_image_name }}:${{ matrix.image }}
EOF
- name: ⏬ Checkout repository
uses: actions/checkout@v6
- name: 🐋 Building MiKTeX image for ${{ matrix.name }}
id: build
run: |
ANSI_RED=$'\x1b[31m'
ANSI_GREEN=$'\x1b[32m'
ANSI_YELLOW=$'\x1b[33m'
ANSI_BLUE=$'\x1b[34m'
ANSI_CYAN=$'\x1b[36m'
ANSI_DARK_GRAY=$'\x1b[90m'
ANSI_LIGHT_BLUE=$'\x1b[94m'
ANSI_NOCOLOR=$'\x1b[0m'
RemoveComments() {
local OutputFile="${2:-$1}"
printf "::group::${ANSI_LIGHT_BLUE}%s${ANSI_NOCOLOR}\n" "Removing comments from '$1' and writing to '${OutputFile}' ..."
grep -v '^\s*$\|^\s*\#' "$1" > "${OutputFile}"
cat "${OutputFile}" | sed 's/^/ /'
printf "::endgroup::\n"
}
DockerImageSizeUncompressed() {
docker image inspect $1 --format='{{.Size}}' | numfmt --to=iec --format '%.2f'
}
printf -- "Convert '${{ matrix.name }}.packages' to 'Install.packages' ...\n"
RemoveComments ${{ matrix.name }}.packages Install.packages
printf -- "Convert '${{ matrix.name }}.npm' to 'Install.npm' ...\n"
RemoveComments ${{ matrix.name }}.npm Install.npm
printf -- "Convert '${{ matrix.name }}.list' to 'Packages.list' ...\n"
RemoveComments ${{ matrix.name }}.list Packages.list
printf -- "Building docker file 'Dockerfile' ...\n"
docker buildx build \
--file Dockerfile.Specific \
--build-arg "IMAGE=${{ needs.MiKTeX.outputs.miktex_image }}" \
--label "org.opencontainers.image.title=MiKTeX specific for ${{ matrix.name }} on Debian ${{ steps.variables.outputs.base_image_os_version }} (${{ steps.variables.outputs.base_image_os_codename }}) + Python ${{ steps.variables.outputs.base_image_py_version }}" \
--label "org.opencontainers.image.description=MiKTeX specific for ${{ matrix.name }} on Debian ${{ steps.variables.outputs.base_image_os_version }} (${{ steps.variables.outputs.base_image_os_codename }}) + Python ${{ steps.variables.outputs.base_image_py_version }} image maintained by pyTooling Authors." \
--label "org.opencontainers.image.authors=Patrick Lehmann <Paebbels@gmail.com>" \
--label "org.opencontainers.image.vendor=pyTooling" \
--label "org.opencontainers.image.version=1.0" \
--label "org.opencontainers.image.revison=${GITHUB_SHA}" \
--label "org.opencontainers.image.created=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--label "org.opencontainers.image.url=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \
--label "org.opencontainers.image.source=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" \
--label "org.opencontainers.image.documentation=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/blob/main/README.md" \
--label "org.opencontainers.image.license=MIT" \
--label "pyTooling.dockerimages.application.variant=${{ matrix.name }}" \
--tag "${{ steps.variables.outputs.specific_image }}" \
. 2>&1 \
| ./Docker.buildx.sh
printf -- "Docker image '%s' has %s\n" "${{ steps.variables.outputs.specific_image }}" "$(DockerImageSizeUncompressed ${{ steps.variables.outputs.specific_image }})"
- name: ☑ Checking MiKTeX image '${{ steps.variables.outputs.specific_image }}'
run: |
DockerImageSizeUncompressed() {
docker image inspect $1 --format='{{.Size}}' | numfmt --to=iec --format '%.2f'
}
printf -- "Docker image '%s' has %s\n" "${{ steps.variables.outputs.specific_image }}" "$(DockerImageSizeUncompressed ${{ steps.variables.outputs.specific_image }})"
printf -- "Labels of '${{ steps.variables.outputs.specific_image }}':\n"
docker inspect --format='{{json .Config.Labels}}' "${{ steps.variables.outputs.specific_image }}" | jq
docker container run --rm ${{ steps.variables.outputs.specific_image }} bash -c 'lualatex --version'
- name: 🔑 Login and push '${{ steps.variables.outputs.specific_image }}' to Docker Hub
run: |
DockerImageSizeUncompressed() {
docker image inspect $1 --format='{{.Size}}' | numfmt --to=iec --format '%.2f'
}
printf -- "Login at Docker Hub ...\n"
printf "%s\n" "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u ${{ vars.DOCKERHUB_USERNAME }} --password-stdin
printf -- "Docker image '%s' has %s\n" "${{ steps.variables.outputs.specific_image }}" "$(DockerImageSizeUncompressed ${{ steps.variables.outputs.specific_image }})"
docker image push ${{ steps.variables.outputs.specific_image }}
SanityCheck-Sphinx:
name: Check MiKTeX for Sphinx installation
runs-on: 'ubuntu-24.04'
needs:
- MiKTeX
- Specific
container:
image: ${{ needs.MiKTeX.outputs.miktex_image_ns }}/${{ needs.MiKTeX.outputs.miktex_image_name }}:sphinx
steps:
- name: Check Mermaid
run: |
sudo -u latex mmdc --version
TriggerTaggedRelease:
uses: pyTooling/Actions/.github/workflows/TagReleaseCommit.yml@r7
needs:
- Prepare
- SanityCheck
- SanityCheck-Sphinx
if: needs.Prepare.outputs.is_release_commit == 'true' && github.event_name != 'schedule'
permissions:
contents: write # required for create tag
actions: write # required for trigger workflow
with:
version: ${{ needs.Prepare.outputs.version }}
auto_tag: ${{ needs.Prepare.outputs.is_release_commit }}
secrets: inherit
ReleasePage:
uses: pyTooling/Actions/.github/workflows/PublishReleaseNotes.yml@r7
needs:
- Prepare
- SanityCheck
- SanityCheck-Sphinx
if: needs.Prepare.outputs.is_release_tag == 'true'
permissions:
contents: write
actions: write
with:
tag: ${{ needs.Prepare.outputs.version }}
secrets: inherit