Skip to content

Commit

Permalink
加入兼容性测试
Browse files Browse the repository at this point in the history
  • Loading branch information
liziwl committed May 16, 2022
1 parent d51c8cf commit c0e170c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ARG TEXLIVE_TAG=latest
FROM texlive/texlive:${TEXLIVE_TAG}

ENV DEBIAN_FRONTEND noninteractive

RUN apt update && \
apt install -y software-properties-common apt-utils && \
DEBIAN_CODENAME=$(lsb_release -c | cut -f2) && \
apt-add-repository "deb http://ftp.debian.org/debian $DEBIAN_CODENAME main contrib" && \
apt update && \
apt install -y ttf-mscorefonts-installer

WORKDIR /docs
25 changes: 16 additions & 9 deletions .github/workflows/compile.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: Build LaTeX document
on: [push,pull_request]
on: [push, pull_request]
jobs:
build_latex:
runs-on: ubuntu-latest
strategy:
matrix:
texlive: [TL2020-historic, TL2021-historic, latest]
# 多版本 TexLive 兼容性测试
# 版本号选自:https://hub.docker.com/r/texlive/texlive/tags
steps:
- name: Set up Git repository
uses: actions/checkout@v2
Expand All @@ -12,13 +17,15 @@ jobs:
- name: Tree All project
run: sudo apt install tree;tree

- name: Compile LaTeX document
uses: xu-cheng/latex-action@v2
with:
root_file: main.tex
latexmk_use_xelatex: true
- name: Build the Docker image
run: |
docker build . --file .github/workflows/Dockerfile --tag sustechthesis --build-arg TEXLIVE_TAG=${{ matrix.texlive }}
docker run --rm -v "$(pwd)":/docs sustechthesis /bin/bash -c "make cleanall && make thesis slide"
- uses: actions/upload-artifact@v2
- name: Publish PDF as actions assets
uses: actions/upload-artifact@v2
with:
name: PDF
path: main.pdf
name: Example-PDFs-texlive-${{ matrix.texlive }}
path: |
main.pdf
slides.pdf
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ LATEXMK = latexmk
SHELL := /bin/bash

THESIS = main
SLIDE = slides

# make deletion work on Windows
ifdef SystemRoot
Expand All @@ -10,21 +11,30 @@ else
RM = rm -f
endif

.PHONY: all clean cleanall thesis viewthesis FORCE_MAKE
.PHONY: all clean cleanall thesis slide viewthesis viewslide FORCE_MAKE

thesis: $(THESIS).pdf
slide: $(SLIDE).pdf

all: thesis

$(THESIS).pdf: FORCE_MAKE
$(LATEXMK) $(THESIS)

$(SLIDE).pdf: FORCE_MAKE
$(LATEXMK) $(SLIDE)

viewthesis: thesis
$(LATEXMK) -pv $(THESIS)

viewslide: slide
$(LATEXMK) -pv $(SLIDE)

clean:
$(LATEXMK) -c $(THESIS)
$(LATEXMK) -c $(SLIDE)
-@$(RM) -rf *~

cleanall: clean
-@$(RM) $(THESIS).pdf
-@$(RM) $(SLIDE).pdf

0 comments on commit c0e170c

Please sign in to comment.