Skip to content

Commit

Permalink
feat: add ubuntu series base image
Browse files Browse the repository at this point in the history
  • Loading branch information
zydou committed Aug 29, 2023
1 parent 556f977 commit 337d8d2
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 42 deletions.
42 changes: 25 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ on:
- cron: 0 12 1 * *
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
strategy:
fail-fast: false
matrix:
texlive_version: [2018, 2019, 2020, 2021, 2022, 2023, latest]
debian_release: [buster, bullseye, bookworm, trixie]
name: Test ${{matrix.texlive_version}}-${{matrix.debian_release}}
base_image: [buster, bullseye, bookworm, trixie, xenial, bionic, focal, jammy]
name: Test ${{matrix.texlive_version}}-${{matrix.base_image}}
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
Expand All @@ -32,15 +36,15 @@ jobs:
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: test.tex
working_directory: test/

- name: Compile LaTeX document with pre/post compile actions
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: test.tex
working_directory: test/
pre_compile: |
Expand All @@ -52,7 +56,7 @@ jobs:
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: |
file1.tex
file2.tex
Expand All @@ -62,15 +66,15 @@ jobs:
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: glob_test*.tex
working_directory: test/

- name: Compile multiple LaTeX documents in different directories
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: subdir*/main.tex
working_directory: test/
work_in_root_file_dir: true
Expand All @@ -79,7 +83,7 @@ jobs:
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: extglob/!(subdir3)_glob/*.tex
working_directory: test/
work_in_root_file_dir: true
Expand All @@ -88,7 +92,7 @@ jobs:
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: globstar/**/*.tex
working_directory: test/
work_in_root_file_dir: true
Expand All @@ -97,31 +101,33 @@ jobs:
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: math.tex
working_directory: test/

- name: Compile LaTeX document with biblatex/biber
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: biblatex.tex
working_directory: test/

- name: Compile LaTeX document with eps figure
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: eps.tex
working_directory: test/

- name: Compile LaTeX document with minted and lualatex
# skip for xenial and bionic because of pygments issue
if: matrix.base_image != 'xenial' && matrix.base_image != 'bionic'
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: minted.tex
working_directory: test/
latexmk_shell_escape: true
Expand All @@ -135,7 +141,7 @@ jobs:
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: extra_fonts.tex
working_directory: test/
latexmk_use_xelatex: true
Expand All @@ -145,7 +151,7 @@ jobs:
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: graphviz.tex
working_directory: test/
compiler: arara
Expand All @@ -156,7 +162,7 @@ jobs:
uses: ./
with:
texlive_version: ${{ matrix.texlive_version }}
debian_release: ${{ matrix.debian_release }}
base_image: ${{ matrix.base_image }}
root_file: |
error.tex
not_error.tex
Expand Down Expand Up @@ -203,6 +209,8 @@ jobs:
run: file test/eps.pdf | grep -q ' PDF '

- name: Test minted and lualatex (minted.tex)
# skip for xenial and bionic because of pygments issue
if: matrix.base_image != 'xenial' && matrix.base_image != 'bionic'
run: file test/minted.pdf | grep -q ' PDF '

- name: Test extra_fonts (extra_fonts.tex)
Expand All @@ -219,6 +227,6 @@ jobs:
- name: Upload
uses: actions/upload-artifact@v3
with:
name: texlive-${{ matrix.texlive_version }}-${{ matrix.debian_release }}
name: texlive-${{ matrix.texlive_version }}-${{ matrix.base_image }}
path: test
if: always()
42 changes: 20 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,26 @@ This is a GitHub Action to compile LaTeX documents, and it's based on [xu-cheng/

| | **Original** | **This Action** |
| ----------------------- | ------------ | --------------- |
| base image | Alpine | Debian |
| base image | Alpine | Debian & Ubuntu |
| install system packages | apk add | apt-get install |
| choose texlive version |||
| choose base image | / ||
| change texlive version |||
| change base image | / ||

The main difference is that this action uses `Debian` as the base image, whereas the original uses `Alpine`. Certain tools require `glibc` to function properly. With Debian OS, you won't encounter any glibc-related issues and can use `apt-get` to install a wider range of packages compared to using `apk` in Alpine. For instance, the Alpine-based image lacks the [xindy package](https://github.com/xu-cheng/latex-action/issues/32).
The main difference is that this action uses `Debian` or `Ubuntu` as the base image, whereas the original uses `Alpine`. Certain tools require `glibc` to function properly. Within debian or ubuntu, you won't encounter any glibc-related issues and can use `apt-get` to install a wider range of packages compared to using `apk` in Alpine. For instance, the Alpine-based image lacks the [xindy package](https://github.com/xu-cheng/latex-action/issues/32).

In addition, this action also allows you to specify the TeX Live version and the Debian release version through input parameters. In contrast, the original action requires the use of different tags to specify the TeX Live version. The advantage of this is that you can easily use `matrix` syntax to build your document with multiple TeX Live versions. For example:
In addition, this action also allows you to specify the TeX Live version and the base image version through input parameters. ~~In contrast, the original action requires the use of different tags to specify the TeX Live version.~~ The advantage of this is that you can easily use `matrix` syntax to build your document with multiple TeX Live versions. For example:

```yaml
jobs:
build_latex:
strategy:
fail-fast: false
matrix:
texlive: [2023, 2022, 2021, 2020, 2019, 2018] # `latest` is also valid
debian: [buster, bullseye, bookworm, trixie]
name: texlive-${{ matrix.texlive }}-${{ matrix.debian_release }}
texlive_version: [2023, 2022, 2021, 2020, 2019, 2018] # `latest` is also valid
base_image: [buster, bullseye, bookworm, trixie, xenial, bionic, focal, jammy]
name: texlive-${{ matrix.texlive_version }}-${{ matrix.base_image }}
```
It's not possible to do this for the original action because currently GitHub Actions doesn't support to use `matrix` syntax in `uses` field.

## Inputs
Each input is provided as a key inside the `with` section of the action.
Expand Down Expand Up @@ -93,11 +91,11 @@ Each input is provided as a key inside the `with` section of the action.
- `texlive_version` (optional, defaults to: "latest")

The TeX Live version to be used. Currently, you can choose from `2018`, `2019`, `2020`, `2021`, `2022`, `2023`, or `latest`.
The TeX Live version to be used. Currently, you can choose from `2018`, `2019`, `2020`, `2021`, `2022`, `2023`, or `latest`. (These choices may be outdated, please [check this page for the latest choices](https://github.com/zydou/texlive))

- `debian_release` (optional, defaults to: "trixie")
- `base_image` (optional, defaults to: "trixie")

The Debian release of base image to be used. Currently, you can choose from `buster`, `bullseye`, `bookworm`, or `trixie`.
The base image version to be used. Currently, you can choose from `buster`, `bullseye`, `bookworm`, `trixie`, `xenial`, `bionic`, `focal`, or `jammy`. (These choices may be outdated, please [check this page for the latest choices](https://github.com/zydou/texlive))

**The following inputs are only valid if the input `compiler` is not changed.**

Expand Down Expand Up @@ -132,10 +130,10 @@ jobs:
strategy:
fail-fast: false
matrix:
texlive: [2023, 2022, 2021] # choose from 2018 to 2023, or latest
# if you need to use different debian release, uncomment the following line
# debian: [buster, bullseye, bookworm, trixie]
name: Build with texlive-${{ matrix.texlive }}
# choose from 2018 to 2023, or latest
texlive_version: [2023, 2022, 2021]
# base_image: [buster, bullseye, bookworm, trixie, xenial, bionic, focal, jammy]
name: Build with texlive-${{ matrix.texlive_version }}
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -145,10 +143,10 @@ jobs:
- name: Compile LaTeX document
uses: zydou/latex-action@v3
with:
texlive_version: ${{ matrix.texlive }}
texlive_version: ${{ matrix.texlive_version }}
# base_image: ${{ matrix.base_image }}
work_in_root_file_dir: true
continue_on_error: true
glob_root_file: true
root_file: |
**/*.tex
Expand All @@ -166,11 +164,11 @@ jobs:
mkdir public
find . -type f -name "*.pdf" -exec cp {} public \;
- name: Push pdf files to texlive-${{matrix.texlive}} branch
- name: Push pdf files to texlive-${{matrix.texlive_version}} branch
if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: texlive-${{ matrix.texlive }}
branch: texlive-${{ matrix.texlive_version }}
folder: ./public
single-commit: true
commit-message: ${{ github.event.head_commit.message }}
Expand Down Expand Up @@ -243,7 +241,7 @@ Sometimes you may have custom package (`.sty`) or class (`.cls`) files in other
with:
root_file: main.tex
env:
TEXINPUTS: ".:./custom_template//:"
TEXINPUTS: '.:./custom_template//:'
```

You can find more information of `TEXINPUTS` [here](https://tex.stackexchange.com/a/93733).
Expand Down
18 changes: 15 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ inputs:
texlive_version:
description: Tex Live version to be used
default: latest
debian_release:
description: Debian debian_release to be used
base_image:
description: Base image to be used
default: trixie
debian_release:
description: "[Deprecated] use `base_image` instead"
default: deprecated
root_file:
description: The root LaTeX file to be compiled
required: true
Expand Down Expand Up @@ -52,6 +55,15 @@ inputs:
runs:
using: composite
steps:
- name: set base_image
shell: bash
run: |
if [[ "${{ inputs.debian_release }}" != "deprecated" ]]; then
echo "Deprecated warning: `debian_release` is deprecated, use `base_image` instead."
echo "BASE_IMG=${{ inputs.debian_release }}" >> "${GITHUB_ENV}"
else
echo "BASE_IMG=${{ inputs.base_image }}" >> "${GITHUB_ENV}"
fi
- shell: bash
run: >
docker run --rm
Expand Down Expand Up @@ -115,7 +127,7 @@ runs:
-v "$GITHUB_ACTION_PATH/entrypoint.sh":/entrypoint.sh
-w "$GITHUB_WORKSPACE"
--entrypoint "/entrypoint.sh"
zydou/texlive:${{ inputs.texlive_version }}-${{ inputs.debian_release }}
zydou/texlive:${{ inputs.texlive_version }}-${{ env.BASE_IMG }}
"${{ inputs.root_file }}"
"${{ inputs.working_directory }}"
"${{ inputs.work_in_root_file_dir }}"
Expand Down

0 comments on commit 337d8d2

Please sign in to comment.