Skip to content

Commit

Permalink
Fixed build failure by pulling in everyshi nested dependency after ms…
Browse files Browse the repository at this point in the history
… package was unlisted.

Bumped CI/runtime dependencies
  • Loading branch information
JasonYao committed Aug 4, 2024
1 parent a6663b7 commit 55dbac0
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 32 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,27 @@ jobs:

# Sets up environment
- name: Checkout repo code
uses: actions/checkout@v2
uses: actions/checkout@v4
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."

- name: Python 3 setup
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.9' # Version range or exact version of a Python version to use, using SemVer's version range syntax
python-version: '3.12.4' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
cache: 'pip' # caching pip dependencies
# We install dev since we're running tests- if we're on our
# local and don't need to run tests, we can just do:
# pip install -r requirements-core.txt
#
# NOTE: In the 2024 Aug move to actions/setup-python@v5, there was a requirement to move dependencies
# to a requirements.txt file, so we move the core logic to requirements-core.txt, and do a nested recursive
# call from inside of requirements.txt
- run: pip install -r requirements.txt

- name: Cache Texlive
id: cache-texlive
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-texlive-dependencies
with:
Expand All @@ -59,10 +68,14 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
# fonts-font-awesome is for the resume pdf generation
# ghostscript is for the .pdf -> .png conversion
# fonts-font-awesome is for the resume pdf generation
# ghostscript is for the .pdf -> .png conversion
# Attempting to directly install texlive-xetex doesn't work and clashes with the TexLive package manager, since it installs
# an older version which clashes in the PATH
# Shellcheck is a dependency in our testing step, and used to be included by default in previous *nix CI/CD environments, but as
# of the bump to v4 of these GitHub Action steps, now needs to be installed separately
- name: Install dependencies
run: sudo apt-get -y install fonts-font-awesome ghostscript
run: sudo apt update && sudo apt -y install fonts-font-awesome ghostscript shellcheck

- run: echo "🖥️ The workflow is now ready to test your code on the runner."

Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,30 @@ bin/test
pytest
```

## Local GitHub Actions Debugging
By using the [act](https://github.com/nektos/act) library, we can execute the GitHub Actions CI/CD workflow
locally, enabling us to quickly debug if any issues arise.

Install by running:
```sh
brew install act
```

List detected workflows from repository root by running:
```sh
act -l
```

Dry-run by running:
```sh
act -n
```

Actually execute by running:
```sh
act
```

## License
This repo is licensed under the terms of the MIT license,
a copy of which may be found [here](LICENSE)
39 changes: 21 additions & 18 deletions bin/install_dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ function start() {
# really care
cat /etc/ImageMagick-6/policy.xml
sudo mv /etc/ImageMagick-6/policy.xml /etc/ImageMagick-6/policy.xml.backup

install_python_dependencies
}

function install_texlive_package_manager() {
Expand Down Expand Up @@ -95,20 +93,23 @@ function install_tex_dependency_packages() {
# NOTE:
# - Other additional packages should be added to the block to avoid
# multiple calls to tlmgr
# - Package `ms` gives us `everyshi.sty`, which is a requirement
# - Package `ms` gives us `everyshi.sty`, which is a requirement. Sometime in
# 2024, builds started breaking due to the ms package not being available. From
# https://ctan.org/pkg/ms?lang=en, it appears to that this is due to the package
# being split up, so this ms package is now replaced by everyshi (obsolete)
# - Package `collection-fontsrecommended` contains a lot of fonts,
# but we really just need `EU` and a few others
# - Package `fontawesome` and the binary from apt are both required
info "TexLive: Installing dependencies"
tlmgr install \
if tlmgr install \
datetime2 \
tracklang \
collection-fontsrecommended \
xcolor \
fontawesome \
titlesec \
textpos \
ms \
everyshi \
substr \
isodate \
fontspec \
Expand All @@ -120,24 +121,26 @@ function install_tex_dependency_packages() {
pdfescape \
letltxmacro \
bitset \
xetex
success "TexLive: All dependencies installed"
xetex ; then
success "TexLive: All dependencies installed"
else
warn "TexLive: Failed to install dependencies, dumping out debug info"
warn "TexLive: output of /tmp/texlive/texmf-var/web2c/tlmgr.log is:"
cat /tmp/texlive/texmf-var/web2c/tlmgr.log

# Additional debug if more detailed logging is required
# warn "TexLive: Output of /tmp/texlive/texmf-var/web2c/tlmgr-commands.log is:"
# cat /tmp/texlive/texmf-var/web2c/tlmgr-commands.log
# warn "TexLive: Output of /tmp/texlive/texmf-var/web2c/xetex/xelatex.log is:"
# cat /tmp/texlive/texmf-var/web2c/xetex/xelatex.log
fail "TexLive: Failed to install dependencies, see above debug info"
fi
}

function update_cache_manifest() {
info "Updating cache manifest"
tlmgr list --only-installed --data name,lcat-version > /tmp/texlive/package-manifest.txt
}

function install_python_dependencies() {
# Installs wheel since it throws a warning about falling back
# to using the old setup.py if it's not installed
pip install wheel

# We install dev since we're running tests- if we're on our
# local and don't need to run tests, we can just do
# pip install -r requirements/common.txt
pip install -r requirements/dev.txt
}

start

23 changes: 23 additions & 0 deletions requirements-core.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# We have a full requirements.txt file here so that pip packages can be cached properly in GitHub Actions
#
# NOTE: This is only the runtime requirements

##
# Runtime requirements
##
dacite==1.8.1
iso-639==0.4.5
Jinja2==3.1.4
pycountry==24.6.1
python-dateutil==2.9.0

# Setup tools requirement is for iso-639, otherwise we get the following error:
# "No module named pkg_resources"
iniconfig==2.0.0
MarkupSafe==2.1.5
packaging==24.1
pluggy==1.5.0
setuptools==72.1.0
six==1.16.0
wheel==0.44.0

11 changes: 11 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# We have a full requirements.txt file here so that pip packages can be cached properly in GitHub Actions
#
# NOTE: This is the full runtime + dev requirements

-r requirements-core.txt

##
# Dev requirements
##
pytest==8.3.2

5 changes: 0 additions & 5 deletions requirements/common.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/dev.txt

This file was deleted.

0 comments on commit 55dbac0

Please sign in to comment.