Code Monkey home page Code Monkey logo

setup-tectonic's Introduction

CI Security Rating Maintainability Rating Bugs Code Smells Technical Debt Lines of Code

The wtfjoke/setup-tectonic action is a JavaScript action that sets up Tectonic in your GitHub Actions workflow by:

  • Downloading a requested version of Tectonic and adding it to the PATH.
  • (Optionally) downloading a requested version of Biber and adding it to the PATH.

๐Ÿ”ง Usage

This action can be run on ubuntu-latest, windows-latest, and macos-latest GitHub Actions runners.

The default configuration installs the latest version of Tectonic. The GITHUB_TOKEN is needed to query the Github Releases of tectonic-typesetting/tectonic to download tectonic.

You can even use caching (see example below) to speed up your workflow ๐ŸŽ‰.

See action.yml for a full description of all parameters.

steps:
  - uses: wtfjoke/setup-tectonic@v3
    with:
      github-token: ${{ secrets.GITHUB_TOKEN }}
  - run: tectonic main.tex

You can also download a specific version of Tectonic

steps:
  - uses: wtfjoke/setup-tectonic@v3
    with:
      github-token: ${{ secrets.GITHUB_TOKEN }}
      tectonic-version: 0.14.1
  - run: tectonic main.tex

If you want to use biber, specify a biber version (for a full example see below)

steps:
  - uses: wtfjoke/setup-tectonic@v3
    with:
      github-token: ${{ secrets.GITHUB_TOKEN }}
      biber-version: 2.17
  - run: biber --version

Upload pdf (using actions/upload-artifact)

name: 'Build LaTex Document'
on:
  push:
jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - uses: wtfjoke/setup-tectonic@v3
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
      - name: Run Tectonic
        run: tectonic main.tex
      - name: Upload pdf
        uses: actions/upload-artifact@v3
        with:
          name: main
          path: main.pdf

With enabled cache (using actions/cache)

name: 'Build LaTex Document'
on:
  push:
jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - uses: actions/cache@v3
        name: Tectonic Cache
        with:
          path: ~/.cache/Tectonic
          key: ${{ runner.os }}-tectonic-${{ hashFiles('**/*.tex') }}
          restore-keys: |
            ${{ runner.os }}-tectonic-
      - uses: wtfjoke/setup-tectonic@v3
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
      - name: Run Tectonic
        run: tectonic main.tex
      - name: Upload pdf
        uses: actions/upload-artifact@v3
        with:
          name: main
          path: main.pdf

With biber

name: 'Build LaTex Document with Biber'
on:
  push:
jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - uses: actions/cache@v3
        name: Tectonic Cache
        with:
          path: ~/.cache/Tectonic
          key: ${{ runner.os }}-tectonic-${{ hashFiles('**/*.tex') }}
          restore-keys: |
            ${{ runner.os }}-tectonic-
      - uses: wtfjoke/setup-tectonic@v3
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          biber-version: 'latest'
      - name: Run Tectonic + Biber
        run: tectonic main.tex
      - name: Upload pdf
        uses: actions/upload-artifact@v3
        with:
          name: main
          path: main.pdf

Note: Tectonic has added biber support in 0.7.1 (see changelog). Prior to that version you need to run following commands:

run: |
  tectonic --keep-intermediates --reruns 0 main.tex
  biber main
  tectonic main.tex

๐Ÿ“Š Comparison to other LaTeX/Tectonic actions like vinay0410/tectonic-action

Pro Description
โšก Performance - Supports caching
- Native Javascript Action's are faster than docker (:whale:) based actions
๐Ÿค– Future proofed New tectonic versions right on release without code changes
๐ŸŽจ Customizability Do one thing and do it well - let other actions do what they can do best

Explanation

This action was created because all existing Github Actions for compiling LaTeX documents I came across are docker based actions, which are slower than Javascript based actions.

LaTex Docker images tend to be huge (2gb+). Tectonic images are an exception but they need to be maintained and updated with new Tectonic versions. This is not often the case, at the time of writing my docker image is the only one up to date with the latest tectonic version.

In comparison, this github action doesn't need an update if a new release of tectonic is released, it just works.

The existing github actions doesn't support biber (notable exception: birjolaxew/tectonic-biber-action).

Additionally most of the github actions tend to do too much or are too strict.

This github action has one job, to setup tectonic (and optionally biber). You can choose on your own how you want to call tectonic, how and if you want to cache your dependencies, how and if you want to upload your pdf. Depending on your decisions you can choose the best action to do the corresponding job (eg. actions/cache for caching, actions/upload-artifact or actions/create-release for publishing your pdf)

๐Ÿค“ How does the cache works?

The official cache action actions/cache has three parameters:

  • path - A list of files, directories, and wildcard patterns to cache and restore.
  • key - Primary cache key - If the key has a cache-hit, it means the cache is up to date. The execution of a tool should'nt change the cache anymore.
  • restore-keys - If there is no key hit with key - These will be used to restore the cache. The execution of a tool most likely will change the cache.

Path

For tectonic the cache directories (path) are as follows (see also tectonic-typesetting/tectonic#159):

OS Cache-Directory Run-Command to export it as environment variable
Linux ~/.cache/Tectonic echo TECTONIC_CACHE_PATH=~/.cache/Tectonic >> $GITHUB_ENV
Mac ~/Library/Caches/Tectonic echo TECTONIC_CACHE_PATH=~/Library/Caches/Tectonic >> $GITHUB_ENV
Windows %LOCALAPPDATA%\TectonicProject\Tectonic echo TECTONIC_CACHE_PATH=$env:LOCALAPPDATA\TectonicProject\Tectonic

Key

By calculate the hash all .tex files (see hashFiles('**/*.tex')) and integrate that into the cache-key we can make sure, that another execution of tectonic wont change the result.

Simpler put, as long as no .tex files are changing, the cache wont change.

Restore-Keys

We change our .tex files but still want to use a cache? restore-keys to the rescue ๐Ÿ’ช

When we change our .tex files (either by using a new package or just change the text), the exact cache key wont hit. Still we want to use the cache from the previous runs, as we most likely still use the same packages. So restore keys will use the cache from the previous run and then (at the end of the job execution) will update the existing cache with key.


Thats how the cache works :)

setup-tectonic's People

Contributors

dependabot[bot] avatar habi avatar octocat avatar pr1metine avatar renovate-bot avatar renovate[bot] avatar wombosvideo avatar wtfjoke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

setup-tectonic's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: Invalid schedule: 'Invalid schedule: Failed to parse "schedule:monthly"'

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • โฌ†๏ธ Update lock files

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/follow-version-tag.yml
  • actions/checkout v4
.github/workflows/test.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
.github/workflows/update-dist.yml
  • actions/checkout v4
  • actions/setup-node v4
npm
package.json
  • @actions/core 1.10.1
  • @actions/github 6.0.0
  • @actions/io 1.1.3
  • @actions/tool-cache 2.0.1
  • semver 7.6.2
  • @octokit/types 13.5.0
  • @types/jest 29.5.12
  • @types/node 20.12.12
  • @types/semver 7.5.8
  • @types/uuid 9.0.8
  • @typescript-eslint/eslint-plugin 7.10.0
  • @typescript-eslint/parser 7.10.0
  • @vercel/ncc 0.38.1
  • eslint 8.57.0
  • eslint-plugin-github 4.10.2
  • eslint-plugin-jest 28.5.0
  • eslint-plugin-prettier 5.1.3
  • jest 29.7.0
  • jest-circus 29.7.0
  • js-yaml 4.1.0
  • prettier 3.2.5
  • ts-jest 29.1.3
  • typescript 5.4.5
  • webpack 5.91.0
nvm
.nvmrc
  • node 20.13.1

  • Check this box to trigger a request for Renovate to run again on this repository

Cannot download a specific version of biber

Hi Manuel,
first of all, I'd like to preface this issue by thanking you for your OSS contribution โค๏ธ. Your Action has been instrumental in significantly improving my CI build times.

Unfortunately, I ran into some problems with regards to Biber. The following log output was generated inside act btw:

[release-pls/build] โญ  Run Setup Tectonic
INFO[0001]   โ˜  git clone 'https://github.com/wtfjoke/setup-tectonic' # ref=v1
[release-pls/build]   ๐Ÿณ  docker cp src=/Users/pr1metine/.cache/act/wtfjoke-setup-tectonic@v1/ dst=/var/run/act/actions/wtfjoke-setup-tectonic@v1/
[release-pls/build]   ๐Ÿณ  docker exec cmd=[mkdir -p /var/run/act/actions/wtfjoke-setup-tectonic@v1/] user= workdir=
[release-pls/build]   ๐Ÿณ  docker exec cmd=[node /var/run/act/actions/wtfjoke-setup-tectonic@v1/dist/index.js] user= workdir=
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Finding releases for Tectonic version latest
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Getting build for Tectonic version 0.8.0: linux
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Release: {"id":51168607,"name":"tectonic 0.8.0","version":"0.8.0","tagName":"[email protected]","assets":[{"name":"tectonic-0.8.0-arm-unknown-linux-musleabihf.tar.gz","url":"https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%25400.8.0/tectonic-0.8.0-arm-unknown-linux-musleabihf.tar.gz"},{"name":"tectonic-0.8.0-i686-unknown-linux-gnu.tar.gz","url":"https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%25400.8.0/tectonic-0.8.0-i686-unknown-linux-gnu.tar.gz"},{"name":"tectonic-0.8.0-mips-unknown-linux-gnu.tar.gz","url":"https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%25400.8.0/tectonic-0.8.0-mips-unknown-linux-gnu.tar.gz"},{"name":"tectonic-0.8.0-x86_64-apple-darwin.tar.gz","url":"https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%25400.8.0/tectonic-0.8.0-x86_64-apple-darwin.tar.gz"},{"name":"tectonic-0.8.0-x86_64-pc-windows-gnu.zip","url":"https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%25400.8.0/tectonic-0.8.0-x86_64-pc-windows-gnu.zip"},{"name":"tectonic-0.8.0-x86_64-pc-windows-msvc.zip","url":"https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%25400.8.0/tectonic-0.8.0-x86_64-pc-windows-msvc.zip"},{"name":"tectonic-0.8.0-x86_64-unknown-linux-gnu.tar.gz","url":"https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%25400.8.0/tectonic-0.8.0-x86_64-unknown-linux-gnu.tar.gz"},{"name":"tectonic-0.8.0-x86_64-unknown-linux-musl.tar.gz","url":"https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%25400.8.0/tectonic-0.8.0-x86_64-unknown-linux-musl.tar.gz"},{"name":"tectonic-0.8.0-x86_64.AppImage","url":"https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%25400.8.0/tectonic-0.8.0-x86_64.AppImage"}]}
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Downloading Tectonic from https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%25400.8.0/tectonic-0.8.0-x86_64.AppImage
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Downloading https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%25400.8.0/tectonic-0.8.0-x86_64.AppImage
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Destination /tmp/c6807eda-b589-4909-bdbd-6553215dfe2d
[release-pls/build]   ๐Ÿ’ฌ  ::debug::download complete
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Extracting Tectonic
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Moved Tectonic from /tmp/c6807eda-b589-4909-bdbd-6553215dfe2d to /tmp/1eab2310-8440-451f-841c-70c94e842072/tectonic
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Tectonic path is /tmp/1eab2310-8440-451f-841c-70c94e842072
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Biber version: 2.16
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Downloading Biber from https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/current/binaries/Linux/biber-linux_x86_64.tar.gz/download
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Downloading https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/current/binaries/Linux/biber-linux_x86_64.tar.gz/download
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Destination /tmp/d192df98-3c57-49fb-92b7-0cb681ee6230
[release-pls/build]   ๐Ÿ’ฌ  ::debug::download complete
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Extracting Biber
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Checking tar --version
[release-pls/build]   ๐Ÿ’ฌ  ::debug::tar (GNU tar) 1.30%0ACopyright (C) 2017 Free Software Foundation, Inc.%0ALicense GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.%0AThis is free software: you are free to change and redistribute it.%0AThere is NO WARRANTY, to the extent permitted by law.%0A%0AWritten by John Gilmore and Jay Fenlason.
| [command]/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /tmp/369bbafa-5b3c-4726-bb2e-c2bf905cbfcd -f /tmp/d192df98-3c57-49fb-92b7-0cb681ee6230
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Biber path is /tmp/369bbafa-5b3c-4726-bb2e-c2bf905cbfcd
[release-pls/build]   โœ…  Success - Setup Tectonic

When specifying a biber-version, your GitHub Action always downloads the current version regardless of the specified biber-version:

[release-pls/build]   ๐Ÿ’ฌ  ::debug::Biber version: 2.16
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Downloading Biber from https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/current/binaries/Linux/biber-linux_x86_64.tar.gz/download
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Downloading https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/current/binaries/Linux/biber-linux_x86_64.tar.gz/download

That's because Biber does not strictly follow the Semantic Versioning conventions. Thus, the specified biber-version i. e. 2.16 is labelled invalid and defaults to current:

export const downloadBiber = async (biberVersion: string) => {
const validVersion = valid(biberVersion) || 'current'

Appending a patch version to biber-version i. e. 2.16.0 results in an error:

[release-pls/build]   ๐Ÿ’ฌ  ::debug::Biber version: 2.16.0
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Downloading Biber from https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/2.16.0/binaries/Linux/biber-linux_x86_64.tar.gz/download
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Downloading https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/2.16.0/binaries/Linux/biber-linux_x86_64.tar.gz/download
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Destination /tmp/dd3d23c4-b1c0-40fc-a1dd-fc1fff58759b
[release-pls/build]   ๐Ÿ’ฌ  ::debug::Failed to download from "https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/2.16.0/binaries/Linux/biber-linux_x86_64.tar.gz/download". Code(404) Message(Not Found)
[release-pls/build]   โ—  ::error::Error: Unexpected HTTP response: 404
[release-pls/build]   โ—  ::error::Unexpected HTTP response: 404
[release-pls/build]   โŒ  Failure - Setup Tectonic
Error: exit with `FAILURE`: 1

I should be able to fix this issue on my own. I am going to open a PR for this soon.

Doesn't work with Ubuntu 22.04

I'm using inkscape to convert svg to tex so I need Ubuntu 22.04 for a recent inkscape version in CI. However, tectonic then fails to run with error message

tectonic myfile.tex
dlopen(): error loading libfuse.so.2

AppImages require FUSE to run. 
You might still be able to extract the contents of this AppImage 
if you run it with the --appimage-extract option. 
See https://github.com/AppImage/AppImageKit/wiki/FUSE 
for more information
make: *** [Makefile:28: myfile.pdf] Error 1

Tectonic with biber fails due to biblatex incompatibility

Hi, using the tectonic action with biber fails due to incompatibilities and produces the following error message:

note: Running external tool biber ...
error: the external tool exited with an error code; its stdout was:

===============================================================================
INFO - This is Biber 2.17
INFO - Logfile is 'thesis.blg'
INFO - Reading 'thesis.bcf'
ERROR - Error: Found biblatex control file version 3.7, expected version 3.8.
This means that your biber (2.17) and biblatex (3.16) versions are incompatible.
See compat matrix in biblatex or biber PDF documentation.
INFO - ERRORS: 1
===============================================================================
error: its stderr was:

===============================================================================
===============================================================================
error: the external tool exited with error code 2
Error: Process completed with exit code 1.

I have included the action similar to the example you provided, and use the "latest" version of biber. I don't really see a way of solving this problem, when even the latest biber version does not seem to work. Any input on this would be appreaciated! ๐Ÿ™

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.