Skip to content

Commit

Permalink
ci: build all variants and add release workflow (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzh authored Jun 2, 2021
1 parent c47f50d commit bf4f59d
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 78 deletions.
26 changes: 9 additions & 17 deletions .github/ci/build_all_variants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,16 @@

set -e

sed -i.bak -e "s|usetheme\[.*\]|usetheme\[bannertitle,blue\]|g" main.tex
latexmk -C
latexmk -xelatex
cp main.pdf build/main-bannertitle-blue.pdf

sed -i.bak -e "s|usetheme\[.*\]|usetheme\[bannertitle,red\]|g" main.tex
latexmk -C
latexmk -xelatex
cp main.pdf build/main-bannertitle-red.pdf
rm -rf build

sed -i.bak -e "s|usetheme\[.*\]|usetheme\[blue\]|g" main.tex
latexmk -C
latexmk -xelatex
cp main.pdf build/main-blue.pdf
sed -e "s|usetheme\[.*\]|usetheme\[bannertitle,blue\]|g" main.tex > build-bannertitle-blue.tex
sed -e "s|usetheme\[.*\]|usetheme\[bannertitle,red\]|g" main.tex > build-bannertitle-red.tex
sed -e "s|usetheme\[.*\]|usetheme\[blue\]|g" main.tex > build-blue.tex
sed -e "s|usetheme\[.*\]|usetheme\[red\]|g" main.tex > build-red.tex

sed -i.bak -e "s|usetheme\[.*\]|usetheme\[red\]|g" main.tex
latexmk -C
latexmk -xelatex
cp main.pdf build/main-red.pdf
latexmk $@ build-*.tex

sed -i.bak -e "s|usetheme\[.*\]|usetheme\[bannertitle,blue\]|g" main.tex
mkdir -p build
mv build-*.pdf build/
rm -f build-*.tex
15 changes: 15 additions & 0 deletions .github/ci/build_test_variants.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

rm -rf build

sed -e "s|usetheme\[.*\]|usetheme\[bannertitle,blue\]|g" main.tex > build-bannertitle-blue.tex
sed -e "s|usetheme\[.*\]|usetheme\[red\]|g" main.tex > build-red.tex

latexmk -C
latexmk $@ build-*.tex

mkdir -p build
mv build-*.pdf build/
rm -f build-*.tex
68 changes: 16 additions & 52 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,75 +11,39 @@ on:
name: Build

jobs:
build-lualatex:
build-xelatex:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: checkout code
- run: sed -e "s|usetheme\[.*\]|usetheme\[red\]|g" main.tex -i
name: build theme "red"
- uses: xu-cheng/latex-action@v2
- uses: xu-cheng/texlive-action/full@v1
with:
root_file: main.tex
latexmk_use_lualatex: true
name: build with latexmk (lualatex)
- run: cat main.log
run: |
.github/ci/build_test_variants.sh -halt-on-error -time -quiet -xelatex
name: build with XeLaTeX
- run: cat build-*.log
name: display build log
if: ${{ failure() || success() }}
- run: cp main.pdf main-red.pdf
name: save build result
- run: sed -e "s|usetheme\[.*\]|usetheme\[bannertitle,blue\]|g" main.tex -i
name: build theme "bannertitle, blue"
- uses: xu-cheng/latex-action@v2
with:
root_file: main.tex
latexmk_use_lualatex: true
name: build with latexmk (lualatex)
- run: cat main.log
name: display build log
if: ${{ failure() || success() }}
- run: cp main.pdf main-bannertitle-blue.pdf
name: save build result
- uses: actions/upload-artifact@v2
with:
path: |
main-red.pdf
main-bannertitle-blue.pdf
name: build-lualatex
path: build/
name: build-xelatex
name: upload build artifacts
build-xelatex:
build-lualatex:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: checkout code
- run: sed -e "s|usetheme\[.*\]|usetheme\[red\]|g" main.tex -i
name: build theme "red"
- uses: xu-cheng/latex-action@v2
- uses: xu-cheng/texlive-action/full@v1
with:
root_file: main.tex
latexmk_use_xelatex: true
name: build with latexmk (xelatex)
- run: cat main.log
run: |
.github/ci/build_test_variants.sh -halt-on-error -time -quiet -lualatex
name: build with LuaLaTeX
- run: cat build-*.log
name: display build log
if: ${{ failure() || success() }}
- run: cp main.pdf main-red.pdf
name: save build result
- run: sed -e "s|usetheme\[.*\]|usetheme\[bannertitle,blue\]|g" main.tex -i
name: build theme "bannertitle, blue"
- uses: xu-cheng/latex-action@v2
with:
root_file: main.tex
latexmk_use_xelatex: true
name: build with latexmk (xelatex)
- run: cat main.log
name: display build log
if: ${{ failure() || success() }}
- run: cp main.pdf main-bannertitle-blue.pdf
name: save build result
- uses: actions/upload-artifact@v2
with:
path: |
main-red.pdf
main-bannertitle-blue.pdf
name: build-xelatex
path: build/
name: build-lualatex
name: upload build artifacts
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
on:
push:
branches:
- release
tags:
- "v*"

name: Release

jobs:
release-xelatex:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: checkout code
- uses: xu-cheng/texlive-action/full@v1
with:
run: |
.github/ci/build_all_variants.sh -halt-on-error -time -quiet -xelatex
name: build with XeLaTeX
- run: cat build-*.log
name: display build log
if: ${{ failure() || success() }}
- uses: actions/create-release@latest
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ github.event.head_commit.message }}
draft: true
prerelease: true
- name: add build-bannertitle-red
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/build-bannertitle-blue.pdf
asset_name: build-bannertitle-blue.pdf
asset_content_type: application/pdf
- name: add build-bannertitle-red
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/build-bannertitle-red.pdf
asset_name: build-bannertitle-red.pdf
asset_content_type: application/pdf
- name: add build-blue
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/build-blue.pdf
asset_name: build-blue.pdf
asset_content_type: application/pdf
- name: add build-red
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/build-red.pdf
asset_name: build-red.pdf
asset_content_type: application/pdf
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,7 @@ main.pdf
thesis-bot.yml

*.bak*

build/
build-*.pdf
build-*.tex
2 changes: 0 additions & 2 deletions .latexmkrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# Set timezone.
$ENV{'TZ'}='Asia/Shanghai';

# Use xelatex with latexmk.
$pdf_mode = 5;
$postscript_mode = $dvi_mode = 0;

# Always try to embed fonts, ignoring licensing flags, etc.
Expand Down
8 changes: 7 additions & 1 deletion contents/basis.tex
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ \subsubsection{支持向量机的诞生}
第一个趣闻
\end{column}
\end{columns}

\end{frame}


Expand Down Expand Up @@ -488,6 +487,13 @@ \subsubsection{支持向量机的诞生}
\end{itemize}
\end{frame}

\begin{frame}[fragile]{文献引用}
\begin{itemize}
\item 新时期我国信息技术产业的发展 \cite{devoftech}
\item 他改变了中国 \cite{thelegendofjiang}
\end{itemize}
\end{frame}

\begin{frame}[fragile]
\frametitle{宏包推荐(\textbf{先读文档}后使用)}
\setlength{\leftmarginii}{1.5em}
Expand Down
19 changes: 13 additions & 6 deletions thesis.bib
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
@inproceedings{karonte,
author={Nilo Redini and Aravind Machiry and Ruoyu Wang and Chad Spensky and Andrea Continella and Yan Shoshitaishvili and Christopher Kruegel and Giovanni Vigna},
booktitle={In Proceedings of the IEEE Symposium on Security \& Privacy (S\&P)},
month={5},
title={KARONTE: Detecting Insecure Multi-binary Interactions in Embedded Firmware},
year={2020}
@article{thelegendofjiang,
title={《他改变了中国: 江泽民传》},
author={罗伯特 and 劳伦斯 and 库恩},
journal={中国企业家},
number={5},
pages={120--120},
year={2005}
}

@phdthesis{devoftech,
title={新时期我国信息技术产业的发展},
author={江泽民},
year={2008}
}

0 comments on commit bf4f59d

Please sign in to comment.