Skip to content

Commit

Permalink
Builds with GitHub actions (#251)
Browse files Browse the repository at this point in the history
* Add missing fonts and make necessary changes in the .tex file.

* Add Github action workflow file.

* Cut building time by at least 4.

* Add more information.
  • Loading branch information
drupol authored Jul 21, 2020
1 parent 78971a9 commit 3832e56
Show file tree
Hide file tree
Showing 20 changed files with 117 additions and 2 deletions.
115 changes: 115 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Build

on:
- push

jobs:
dependencies:
name: Build dependencies
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}

steps:
- name: Set up Git repository
uses: actions/checkout@v1

- name: Create global variables
id: version
run: echo "::set-output name=version::$(git rev-parse --short HEAD)"

build:
name: Build documents
needs: dependencies
runs-on: ubuntu-latest
strategy:
matrix:
sources:
- input: ctfp-print.tex
output: ctfp-print.pdf
- input: ctfp-reader.tex
output: ctfp-reader.pdf
- input: ctfp-print-scala.tex
output: ctfp-print-scala.pdf
- input: ctfp-reader-scala.tex
output: ctfp-reader-scala.pdf
- input: ctfp-reader-ocaml.tex
output: ctfp-reader-ocaml.pdf
- input: ctfp-print-ocaml.tex
output: ctfp-print-ocaml.pdf

steps:
- name: Set up Git repository
uses: actions/checkout@v1

- name: Create necessary build file (version.tex)
run: |
echo -n -e "\\\newcommand{\OPTversion}{$(git rev-parse --short HEAD)}" > src/version.tex
- name: Build documents using LaTeX (${{ matrix.sources.input }})
uses: xu-cheng/latex-action@v2
with:
working_directory: src
latexmk_use_xelatex: true
root_file: ${{ matrix.sources.input }}
latexmk_shell_escape: true

- name: Upload build assets (${{ matrix.sources.output }})
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.sources.output }}
path: src/${{ matrix.sources.output }}

release:
name: "Create Github tag/pre-release"
runs-on: ubuntu-latest
needs: [dependencies,build]
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Github pre-release (${{ needs.dependencies.outputs.version }})
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.dependencies.outputs.version }}
release_name: Version ${{ needs.dependencies.outputs.version }}
draft: false
prerelease: true

assets:
name: Upload release assets
runs-on: ubuntu-latest
needs: [dependencies,release]
strategy:
matrix:
assets:
- source: ctfp-print.pdf
destination: category-theory-for-programmers--print--
- source: ctfp-reader.pdf
destination: category-theory-for-programmers--
- source: ctfp-print-scala.pdf
destination: category-theory-for-programmers--print--scala--
- source: ctfp-reader-scala.pdf
destination: category-theory-for-programmers--reader--scala--
- source: ctfp-print-ocaml.pdf
destination: category-theory-for-programmers--print--ocaml--
- source: ctfp-reader-ocaml.pdf
destination: category-theory-for-programmers--reader--ocaml--
steps:
- name: Download build assets (${{ matrix.assets.source }})
uses: actions/download-artifact@v2
with:
name: ${{ matrix.assets.source }}
path: ${{ matrix.assets.source }}

- name: Upload release assets (${{ matrix.assets.destination }}${{ needs.dependencies.outputs.version }}.pdf)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ matrix.assets.source }}/${{ matrix.assets.source }}
asset_name: ${{ matrix.assets.destination }}${{ needs.dependencies.outputs.version }}.pdf
asset_content_type: application/pdf
Binary file added src/fonts/Inconsolata-LGC-Bold.ttf
Binary file not shown.
Binary file added src/fonts/Inconsolata-LGC-BoldItalic.ttf
Binary file not shown.
Binary file added src/fonts/Inconsolata-LGC-Italic.ttf
Binary file not shown.
Binary file added src/fonts/Inconsolata-LGC.ttf
Binary file not shown.
Binary file added src/fonts/LibertinusKeyboard-Regular.otf
Binary file not shown.
Binary file added src/fonts/LibertinusMath-Regular.otf
Binary file not shown.
Binary file added src/fonts/LibertinusMono-Regular.otf
Binary file not shown.
Binary file added src/fonts/LibertinusSans-Bold.otf
Binary file not shown.
Binary file added src/fonts/LibertinusSans-Italic.otf
Binary file not shown.
Binary file added src/fonts/LibertinusSans-Regular.otf
Binary file not shown.
Binary file added src/fonts/LibertinusSerif-Bold.otf
Binary file not shown.
Binary file added src/fonts/LibertinusSerif-BoldItalic.otf
Binary file not shown.
Binary file added src/fonts/LibertinusSerif-Italic.otf
Binary file not shown.
Binary file added src/fonts/LibertinusSerif-Regular.otf
Binary file not shown.
Binary file added src/fonts/LibertinusSerif-Semibold.otf
Binary file not shown.
Binary file added src/fonts/LibertinusSerif-SemiboldItalic.otf
Binary file not shown.
Binary file added src/fonts/LibertinusSerifDisplay-Regular.otf
Binary file not shown.
Binary file added src/fonts/LibertinusSerifInitials-Regular.otf
Binary file not shown.
4 changes: 2 additions & 2 deletions src/preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
\defaultfontfeatures{% % is important for
Scale=MatchLowercase, % needed here ... % single quotes not
} % to turn out curly
\setmonofont[BoldFont={Inconsolata LGC Bold}]{Inconsolata LGC} % ("typographic")
\setmonofont[Path=fonts/, BoldFont=Inconsolata-LGC-Bold.ttf]{Inconsolata-LGC-Bold.ttf} % ("typographic")
% in verbatim blocks
\defaultfontfeatures{% % of Haskell code.
Scale=MatchLowercase, % ... and here again % Now the quote is
Expand All @@ -43,7 +43,7 @@
\expandafter\let\csname not<\endcsname\relax
\expandafter\let\csname not>\endcsname\relax
\usepackage{unicode-math}
\setmathfont{Libertinus Math}
\setmathfont[Path=fonts/]{LibertinusMath-Regular.otf}

\usepackage[all]{nowidow}
\usepackage{emptypage}
Expand Down

0 comments on commit 3832e56

Please sign in to comment.