Merge pull request #65 from DeveloperPaul123/feature/project-infastructure-updates

This commit is contained in:
Paul T
2024-09-19 02:23:10 -04:00
committed by GitHub
17 changed files with 435 additions and 46 deletions

View File

@@ -1,23 +0,0 @@
name: Build documentation
on: [push, workflow_dispatch]
jobs:
build_pdf:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4
- name: Install fonts
run: |
sudo apt update
sudo apt-get install fonts-font-awesome fonts-roboto texlive-fonts-recommended texlive-fonts-extra
- name: Typst
uses: yusancky/setup-typst@v2
id: setup-typst
with:
version: 'v0.11.0'
- run: typst compile modern-cv-docs.typ
- name: Upload PDF file
uses: actions/upload-artifact@v3
with:
name: modern-cv-docs
path: modern-cv-docs.pdf

77
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,77 @@
name: Package and push to registry repo
on:
push:
tags: [ '*' ]
env:
# the repository to which to push the release version
# usually a fork of typst/packages (https://github.com/typst/packages/)
# that you have push privileges to
REGISTRY_REPO: DeveloperPaul123/typst-packages
# the path within that repo where the "<name>/<version>" directory should be put
# for the Typst package registry, keep this as is
PATH_PREFIX: packages/preview
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Probe runner package cache
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: cargo
version: 1.0
- name: Install just from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: just
- name: Setup typst
uses: typst-community/setup-typst@v3
with:
typst-version: latest
- name: Determine and check package metadata
run: |
. scripts/setup
echo "PKG_NAME=${PKG_PREFIX}" >> "${GITHUB_ENV}"
echo "PKG_VERSION=${VERSION}" >> "${GITHUB_ENV}"
if [[ "${GITHUB_REF_NAME}" != "v${VERSION}" ]]; then
echo "package version ${VERSION} does not match release tag ${GITHUB_REF_NAME}" >&2
exit 1
fi
- name: Build package
run: |
just doc
just package out
- name: Checkout package registry
uses: actions/checkout@v4
with:
repository: ${{ env.REGISTRY_REPO }}
token: ${{ secrets.REGISTRY_TOKEN }}
path: typst-packages
- name: Release package
run: |
mkdir -p "typst-packages/${{ env.PATH_PREFIX }}/$PKG_NAME"
mv "out/${PKG_NAME}/${PKG_VERSION}" "typst-packages/${{ env.PATH_PREFIX }}/${PKG_NAME}"
rmdir "out/${PKG_NAME}"
rmdir out
GIT_USER_NAME="$(git log -1 --pretty=format:'%an')"
GIT_USER_EMAIL="$(git log -1 --pretty=format:'%ae')"
cd typst-packages
git config user.name "${GIT_USER_NAME}"
git config user.email "${GIT_USER_EMAIL}"
git checkout -b "${PKG_NAME}-${PKG_VERSION}"
git add .
git commit -m "${PKG_NAME}:${PKG_VERSION}"
git push --set-upstream origin "${PKG_NAME}-${PKG_VERSION}"

83
.github/workflows/tests.yml vendored Normal file
View File

@@ -0,0 +1,83 @@
name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
tests:
strategy:
matrix:
# add any other Typst versions that your package should support
typst-version: ["0.11"]
# the docs don't need to build with all versions supported by the package;
# the latest one is enough
include:
- typst-version: "0.11"
doc: 1
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Probe runner package cache
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: imagemagick cargo
version: 1.0
- name: Install oxipng from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: oxipng
- name: Install just from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: just
- name: Install typst-test from github
uses: baptiste0928/cargo-install@v3
with:
crate: typst-test
git: https://github.com/tingerrr/typst-test.git
tag: ci-semi-stable
- name: Setup typst
uses: typst-community/setup-typst@v3
with:
typst-version: ${{ matrix.typst-version }}
- name: Install fonts
run: |
sudo apt update
sudo apt-get install fonts-font-awesome fonts-roboto
./scripts/install-fontawesome
- name: Install locally
run: just install
- name: Run test suite
run: just test
- name: Archive diffs
uses: actions/upload-artifact@v4
if: always()
with:
name: diffs
path: |
tests/**/diff/*.png
tests/**/out/*.png
tests/**/ref/*.png
retention-days: 5
- name: Build docs
if: ${{ matrix.doc }}
run: just doc
- name: Upload docs
uses: actions/upload-artifact@v4
with:
name: manual
path: docs/manual.pdf

4
.gitignore vendored
View File

@@ -1 +1,3 @@
*.pdf *.pdf
tests/*/diff
tests/*/out

View File

@@ -4,4 +4,5 @@ scripts
template/*.pdf template/*.pdf
.gitignore .gitignore
.issuetracker .issuetracker
modern-cv-docs.* tests/*
docs/*

45
Justfile Normal file
View File

@@ -0,0 +1,45 @@
root := justfile_directory()
export TYPST_ROOT := root
[private]
default:
@just --list --unsorted
# generate manual
doc:
typst compile docs/manual.typ docs/manual.pdf
# run test suite
test *args:
typst-test run {{ args }}
# update test cases
update *args:
typst-test update {{ args }}
# package the library into the specified destination folder
package target:
./scripts/package "{{target}}"
# install the library with the "@local" prefix
install: (package "@local")
# install the library with the "@preview" prefix (for pre-release testing)
install-preview: (package "@preview")
[private]
remove target:
./scripts/uninstall "{{target}}"
# uninstalls the library from the "@local" prefix
uninstall: (remove "@local")
# uninstalls the library from the "@preview" prefix (for pre-release testing)
uninstall-preview: (remove "@preview")
format:
./scripts/format
# run ci suite
ci: test doc

View File

@@ -9,6 +9,17 @@ A port of the [Awesome-CV](https://github.com/posquit0/Awesome-CV) Latex resume
## Requirements ## Requirements
### Tools
The following tools are used for the development of this template:
- [typst](https://github.com/typst/typst), obviously
- [typst-test](https://github.com/tingerrr/typst-test) for running tests
- [just](https://github.com/casey/just) for simplifying command running
- [oxipng](https://github.com/shssoichiro/oxipng) for compressing thumbnails used in the README
### Fonts
You will need the `Roboto` and `Source Sans Pro` fonts installed on your system or available somewhere. If you are using the `typst` web app, no further action is necessary. You can download them from the following links: You will need the `Roboto` and `Source Sans Pro` fonts installed on your system or available somewhere. If you are using the `typst` web app, no further action is necessary. You can download them from the following links:
- [Roboto](https://fonts.google.com/specimen/Roboto) - [Roboto](https://fonts.google.com/specimen/Roboto)
@@ -83,17 +94,19 @@ Documentation for this template is published with each commit. See the attached
To build and test the project locally, you will need to install the `typst` CLI. You can find instructions on how to do this [here](https://typst.app/docs/getting-started). To build and test the project locally, you will need to install the `typst` CLI. You can find instructions on how to do this [here](https://typst.app/docs/getting-started).
With typst installed you can make changes to `lib.typ` and then `install_package_locally.ps1` to install the package locally. Change the import statements in the template files to point to the local package: With typst installed you can make changes to `lib.typ` and then `just install` or `just install-preview` to install the package locally. Change the import statements in the template files to point to the local package (if needed):
```typst ```typst
#import "@local/modern-cv:0.3.0": * #import "@local/modern-cv:0.6.0": *
```` ````
If you use `just install-preview` you will only need to update the version number to match `typst.toml`.
Note that the script parses the `typst.toml` to determine the version number and the folder the local files are installed to. Note that the script parses the `typst.toml` to determine the version number and the folder the local files are installed to.
### Formatting ### Formatting
This project uses [typstyle](https://github.com/Enter-tainer/typstyle) to format the code. The script `format_typst.ps1` will format all the `*.typ` files in the project. Be sure to install `typstyle` before running the script. This project uses [typstyle](https://github.com/Enter-tainer/typstyle) to format the code. Run `just format` to format all the `*.typ` files in the project. Be sure to install `typstyle` before running the script.
## License ## License

View File

@@ -1,8 +1,8 @@
#import "lib.typ" #import "../lib.typ"
#import "@preview/tidy:0.3.0" #import "@preview/tidy:0.3.0"
#let docs = tidy.parse-module( #let docs = tidy.parse-module(
read("lib.typ"), read("../lib.typ"),
name: "Modern CV", name: "Modern CV",
scope: (resume: lib), scope: (resume: lib),
) )

View File

@@ -1,4 +1,4 @@
#import "@preview/fontawesome:0.2.1": * #import "@preview/fontawesome:0.4.0": *
#import "@preview/linguify:0.4.0": * #import "@preview/linguify:0.4.0": *
// const color // const color

4
scripts/format Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -eu
find . -iname "*.typ" | xargs typstyle -i

View File

@@ -1,5 +0,0 @@
# requires typstyle to be installed
# cargo install typstyle
# get all *.typ files and format them
Get-ChildItem -Path $PSScriptRoot/../*.typ -Recurse | ForEach-Object { typstyle -i $_.FullName }

11
scripts/install-fontawesome Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -eu
wget -O ~/fontawesome.zip https://use.fontawesome.com/releases/v6.6.0/fontawesome-free-6.6.0-desktop.zip
mkdir -p ~/fontawesome-fonts
unzip ~/fontawesome.zip -d ~/fontawesome-fonts
mkdir -p ~/.fonts
find ~/fontawesome-fonts -type f -name "*.otf" -exec cp {} ~/.fonts \;
rm ~/fontawesome.zip
rm -rf ~/fontawesome-fonts
fc-cache -f -v

View File

@@ -1,10 +0,0 @@
# requires the PSToml cmdlet to be installed
# https://github.com/jborean93/PSToml?tab=readme-ov-file
# Install-Module -Name PSToml -Scope AllUsers
$typst_toml = ConvertFrom-Toml (Get-Content "$PSScriptRoot/../typst.toml" -Raw)
Write-Host 'Package version: ' $typst_toml.package.version
$Source = "$PSScriptRoot/../*"
$Destination = "$env:LOCALAPPDATA/typst/packages/local/modern-cv/$($typst_toml.package.version)"
New-Item -ItemType Directory -Path $Destination -Force
Copy-Item -Path $Source -Destination $Destination -Recurse -Force

BIN
tests/resume/ref/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

99
tests/resume/test.typ Normal file
View File

@@ -0,0 +1,99 @@
#import "@local/modern-cv:0.7.0": *
// setup the document like we do for the resume
#let font = ("Source Sans Pro", "Source Sans 3")
#set text(
font: font,
size: 11pt,
fill: color-darkgray,
fallback: true,
)
#set page(
paper: "a4",
margin: (left: 15mm, right: 15mm, top: 10mm, bottom: 10mm),
footer: [],
footer-descent: 0pt,
)
// set paragraph spacing
#show par: set block(
above: 0.75em,
below: 0.75em,
)
#set par(justify: true)
#set heading(
numbering: none,
outlined: false,
)
#show heading.where(level: 1): it => [
#set block(
above: 1em,
below: 1em,
)
#set text(
size: 16pt,
weight: "regular",
)
#align(left)[
#let color = if colored-headers {
accent-color
} else {
color-darkgray
}
#text[#strong[#text(color)[#it.body.text]]]
#box(width: 1fr, line(length: 100%))
]
]
#show heading.where(level: 2): it => {
set text(
color-darkgray,
size: 12pt,
style: "normal",
weight: "bold",
)
it.body
}
#show heading.where(level: 3): it => {
set text(
size: 10pt,
weight: "regular",
)
smallcaps[#it.body]
}
// test the resume functions
#resume-item("Education")
#resume-entry(
title: "BSc Computer Science",
location: "Example City",
date: "2019 - 2022",
description: "Achieved acaademic honors and awards.",
)
// resume-entry also support omitting the date and description
#resume-entry(
title: "Title",
location: "Location",
)
#resume-certification(
"Certified Scrum Master (CSM)",
"Jan 2022",
)
#resume-skill-item(
"Programming",
(strong["C++"], "Python", "Java"),
)
#resume-gpa("3.5", "4.0")

BIN
tests/utilities/ref/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

92
tests/utilities/test.typ Normal file
View File

@@ -0,0 +1,92 @@
#import "@local/modern-cv:0.7.0": *
// setup the document like we do for the resume
#let font = ("Source Sans Pro", "Source Sans 3")
#set text(
font: font,
size: 11pt,
fill: color-darkgray,
fallback: true,
)
#set page(
paper: "a4",
margin: (left: 15mm, right: 15mm, top: 10mm, bottom: 10mm),
footer: [],
footer-descent: 0pt,
)
// set paragraph spacing
#show par: set block(
above: 0.75em,
below: 0.75em,
)
#set par(justify: true)
#set heading(
numbering: none,
outlined: false,
)
#show heading.where(level: 1): it => [
#set block(
above: 1em,
below: 1em,
)
#set text(
size: 16pt,
weight: "regular",
)
#align(left)[
#let color = if colored-headers {
accent-color
} else {
color-darkgray
}
#text[#strong[#text(color)[#it.body.text]]]
#box(width: 1fr, line(length: 100%))
]
]
#show heading.where(level: 2): it => {
set text(
color-darkgray,
size: 12pt,
style: "normal",
weight: "bold",
)
it.body
}
#show heading.where(level: 3): it => {
set text(
size: 10pt,
weight: "regular",
)
smallcaps[#it.body]
}
#justified-header("Modern CV", "A modern curriculum vitae template")
#secondary-justified-header("Created by", "DeveloperPaul123")
#github-link("DeveloperPaul123/modern-cv")
#linkedin-icon
#github-icon
#twitter-icon
#google-scholar-icon
#orcid-icon
#phone-icon
#email-icon
#birth-icon
#homepage-icon
#website-icon
#square(size: 1em, fill: color-darkgray)
#square(size: 1em, fill: color-darknight)
#square(size: 1em, fill: color-gray)
#square(size: 1em, fill: default-accent-color)
#square(size: 1em, fill: default-location-color)