feat: initial tests of building debian based images #157
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 Docker Image | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: "0 0 1 * *" | |
workflow_dispatch: | |
inputs: | |
deploy: | |
type: boolean | |
description: Whether to deploy the build images | |
jobs: | |
build: | |
if: "!(github.event_name == 'push' && contains(github.event.head_commit.message, '[skip ci]'))" | |
strategy: | |
matrix: | |
scheme: [small, full] | |
name: Build TeXLive [${{ matrix.scheme }}-scheme] | |
runs-on: ubuntu-latest | |
env: | |
SCHEME: ${{ matrix.scheme }} | |
TAG: ghcr.io/xu-cheng/texlive-${{ matrix.scheme }}-debian | |
steps: | |
- name: Get version | |
run: | | |
echo "VERSION=$(date "+%Y%m%d")" >> "$GITHUB_ENV" | |
- name: Set up Git repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
build-args: scheme=${{ env.SCHEME }} | |
load: true | |
tags: texlive-${{ env.SCHEME }}-debian | |
- name: Test pdflatex | |
run: | | |
docker run --rm texlive-$SCHEME-debian pdflatex --version | |
cat <<EOF >ref.bib | |
@book{knuth1997, | |
author = {Donald E. Knuth}, | |
title = {The Art of Computer Programming}, | |
volume = {1}, | |
publisher = {Addison-Wesley}, | |
year = {1997} | |
} | |
EOF | |
cat <<EOF >test.tex | |
\documentclass{article} | |
\usepackage{newtxtext} | |
\usepackage[style=authoryear]{biblatex} | |
\addbibresource{ref.bib} | |
\begin{document} | |
Test~\cite{knuth1997}. | |
\printbibliography | |
\end{document} | |
EOF | |
docker run --rm -v "$(pwd):/data" -w /data texlive-$SCHEME-debian \ | |
python3 /opt/texlive/bin/texliveonfly \ | |
-c latexmk -a "-g -pdf -halt-on-error -interaction=nonstopmode" test.tex | |
file test.pdf | grep -q ' PDF ' | |
- name: Test latexindent | |
run: | | |
cat <<EOF >test.tex | |
\documentclass{article} | |
\usepackage{newtxtext} | |
\begin{document} | |
test | |
\end{document} | |
EOF | |
docker run --rm -v $(pwd):/data -w /data texlive-$SCHEME-debian latexindent test.tex | |
- name: Login | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.CR_PAT }} | |
if: "github.ref == 'refs/heads/master' && (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.deploy))" | |
- name: Deploy | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
build-args: scheme=${{ env.SCHEME }} | |
push: true | |
tags: ${{ env.TAG }}:${{ env.VERSION }},${{ env.TAG }}:latest | |
if: "github.ref == 'refs/heads/master' && (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.deploy))" |