From fbf52d75e331126356d100659fe9bd48bdf2a0e9 Mon Sep 17 00:00:00 2001 From: teridax Date: Mon, 1 Jul 2024 16:17:54 +0200 Subject: [PATCH] added test and gitea action workflow --- .gitea/workflows/ci.yml | 19 +++++++++++++++++++ run-ci.sh | 14 ++++++++++++++ src/lib.typ | 10 ++++++---- tests/local-import/main.typ | 29 +++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 .gitea/workflows/ci.yml create mode 100644 run-ci.sh create mode 100644 tests/local-import/main.typ diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..82ec43b --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,19 @@ +name: Gitea Action for checking typst compilation +run-name: ${{ gitea.actor }} is performing typst compilation +on: [push] + +jobs: + Explore-Gitea-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "This job is now running on a ${{ runner.os }}" + - run: echo "The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." + - uses: actions/checkout@v3 + - uses: typst-community/setup-typst@v3 + - run: echo "The ${{ gitea.repository }} repository has been cloned to the runner." + - name: Install dependencies + run: apt update -y + - uses: typst-community/setup-typst@v3 + with: + typst-version: '0.11.0' + - run: bash run-ci.sh diff --git a/run-ci.sh b/run-ci.sh new file mode 100644 index 0000000..c7576d0 --- /dev/null +++ b/run-ci.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +function abort() { + echo "test case `$1` has failed" 1>&2 + exit 1 +} + +echo "Running tests..." + +typst compile tests/local-import/main.typ --root . || abort "local-import" + +echo "Tests completed successfully" diff --git a/src/lib.typ b/src/lib.typ index da91091..e038171 100644 --- a/src/lib.typ +++ b/src/lib.typ @@ -62,12 +62,14 @@ #pagebreak(weak: true) - #heading(supplement: [outline], "Glossar") + #if "glossary" in config.thesis and config.thesis.glossary != none { + heading(supplement: [outline], "Glossar") - #print-glossary(config.thesis.glossary) + print-glossary(config.thesis.glossary) - #pagebreak(weak: true) - #counter(page).update(1) + pagebreak(weak: true) + counter(page).update(1) + } // mark end of prelude #metadata("prelude terminate") diff --git a/tests/local-import/main.typ b/tests/local-import/main.typ new file mode 100644 index 0000000..9197122 --- /dev/null +++ b/tests/local-import/main.typ @@ -0,0 +1,29 @@ + +#import "../../src/lib.typ": dhbw-template + +#show: dhbw-template.with( + config: ( + lang: "en", + region: "en", + author: ( + name: "Sven Vogel", + semester: 4, + program: "Informationtechnology", + course: "TINF19IT1", + faculty: "Technik", + university: "DHBW Mannheim", + company: "ABB AG", + supervisor: "Benny Goodman", + matriculation-number: 123456789), + thesis: ( + title: "Unofficial ABB/DHBW Typst template", + subtitle: "for reports and thesises", + submission-date: "23rd march 2020", + timeframe: "1st january 2020 - 20th march 2020", + kind: "T2000", + summary: none, + abstract: none, + keywords: ( "IT", "other stuff" ), + bibliography: none, + glossary: none, + appendices: none)))