Merge pull request 'added: release on tag CI and changed CI script' (#16) from feature/release-on-tag into main
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 10s Details

Reviewed-on: #16
This commit is contained in:
Sven Vogel 2024-07-04 14:17:32 +00:00
commit 8c3534f8d4
2 changed files with 56 additions and 21 deletions

View File

@ -0,0 +1,26 @@
name: release
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create release
id: create-release
uses: https://gitea.com/actions/release-action@main
with:
files: |-
src/**
template/**
LICENSE
typst.toml
README.md
example.pdf
api_key: '${{secrets.RELEASE_TOKEN}}'

View File

@ -1,33 +1,42 @@
#!/bin/bash #!/bin/bash
function log() {
local timestamp=$(date +"%Y-%m-%d %H:%M:%S")
echo "$1 at $timestamp: $2"
}
function abort() { function abort() {
echo "test case `$1` has failed" 1>&2 log "ERROR" "test case $1 has failed"
exit 1 exit 1
} }
echo "Compiling template..." function print-box() {
typst compile template/main.typ --root . || abort "template" printf "\\n"
echo ".----------------------------------------------------------------."
printf "| %-62s |\\n" "$1"
echo "'----------------------------------------------------------------'"
}
echo "Running tests..." function enter-section() {
print-box "$1"
echo "Running test local-import..." log "INFO" "running task in section $1: $2"
typst compile tests/local-import/main.typ --root . || abort "local-import" log "INFO" "section output following..."
printf "\\n"
echo "Running test invalid-config..." eval "$2"
if [ $? -neq $3 ]; then
echo "Expected to fail..." abort "command: $2 failed in section: $1"
typst compile tests/invalid-config/test-case-1.typ --root .
if [ $? -eq 0 ]; then
abort "invalid-config case 1"
fi fi
typst compile tests/invalid-config/test-case-2.typ --root . || abort "invalid-config case 2" printf "\\n"
log "INFO" "section $1 completed successfully"
}
echo "Expected to fail..." enter-section "Compiling template..." "typst compile template/main.typ --root . example.pdf" 0
typst compile tests/invalid-config/test-case-3.typ --root . enter-section "TEST: local template import" "typst compile tests/local-import/main.typ --root ." 0
if [ $? -eq 0 ]; then enter-section "TEST: invalid config case 1" "typst compile tests/invalid-config/test-case-1.typ --root ." 1
abort "invalid-config case 3b" enter-section "TEST: invalid config case 2" "compile tests/invalid-config/test-case-2.typ" 0
fi enter-section "TEST: invalid config case 3" "typst compile tests/invalid-config/test-case-3.typ --root ." 1
log "INFO" "CI completed successfully"
echo "Tests completed successfully"