Prepare for migration into spec.
This commit is contained in:
18
.gitea/workflows/compile.yaml
Normal file
18
.gitea/workflows/compile.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
name: Compile Project
|
||||||
|
run-name: Compile the project using spec.
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
Compile:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Add to PATH
|
||||||
|
run: echo "/root/.nvm/versions/node/v24.14.0/bin" >> $GITHUB_PATH
|
||||||
|
- name: Copy source
|
||||||
|
run: |
|
||||||
|
mkdir -p /srv/builds/${{ github.event.repository.name }}
|
||||||
|
cp -r . /srv/builds/${{ github.event.repository.name }}/
|
||||||
|
- name: Compile Website
|
||||||
|
run: spec compile --all
|
||||||
|
working-directory: /srv/builds/${{ github.event.repository.name }}
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"context": "Editor",
|
|
||||||
"bindings": {
|
|
||||||
"ctrl-s": [
|
|
||||||
"workspace::Save",
|
|
||||||
["task::Spawn", { "task_name": "Build and Serve" }],
|
|
||||||
],
|
|
||||||
"ctrl-b": "editor::MoveLeft",
|
|
||||||
"ctrl-i": [
|
|
||||||
"editor::InsertSnippet",
|
|
||||||
{
|
|
||||||
"snippet": "\\textit{$1}$0",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
// Folder-specific settings
|
|
||||||
//
|
|
||||||
// For a full list of overridable settings, and general information on folder-specific settings,
|
|
||||||
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
|
|
||||||
{
|
|
||||||
"lsp": {
|
|
||||||
"texlab": {
|
|
||||||
"settings": {
|
|
||||||
"texlab": {
|
|
||||||
"rootDirectory": ".",
|
|
||||||
"build": {
|
|
||||||
"auxDirectory": ".",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"languages": {
|
|
||||||
"HTML": {
|
|
||||||
"format_on_save": "off",
|
|
||||||
},
|
|
||||||
"Python": {
|
|
||||||
"format_on_save": "off",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"soft_wrap": "preferred_line_length",
|
|
||||||
"preferred_line_length": 80,
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"label": "Build and Serve",
|
|
||||||
"command": "wsl",
|
|
||||||
"args": ["bash", "build-serve.sh"],
|
|
||||||
"cwd": "${ZED_WORKTREE_ROOT}",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Upload to Server",
|
|
||||||
"command": "wsl",
|
|
||||||
"args": ["bash", "upload.sh"],
|
|
||||||
"cwd": "${ZED_WORKTREE_ROOT}",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
10
README.md
10
README.md
@@ -1,10 +0,0 @@
|
|||||||
[](https://github.com/gerby-project/hello-world/actions/workflows/example.yml)
|
|
||||||
|
|
||||||
This repository documents a minimal working example for using Gerby.
|
|
||||||
|
|
||||||
There are two things one can look at
|
|
||||||
|
|
||||||
* the plasTeX-only check, see `.github/workflows/example.yml` (which is checked by the badge)
|
|
||||||
* a full example using the now discontinued Travis, see `.travis.yml`.
|
|
||||||
|
|
||||||
For more information, see [Gerby project](https://gerby-project.github.io).
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
pgrep -f build.sh > /dev/null || ./build.sh
|
|
||||||
pgrep -f serve.sh > /dev/null || ./serve.sh &
|
|
||||||
131
build.groovy
131
build.groovy
@@ -1,131 +0,0 @@
|
|||||||
def projectRoot = '/home/gerby/gerby'
|
|
||||||
|
|
||||||
def vGPython = "${projectRoot}/gerby-venv/bin/python"
|
|
||||||
def vGPip = "${projectRoot}/gerby-venv/bin/pip"
|
|
||||||
|
|
||||||
def vPPython = "${projectRoot}/plastex-venv/bin/python"
|
|
||||||
def vPPip = "${projectRoot}/plastex-venv/bin/pip"
|
|
||||||
|
|
||||||
def vPlastex = "${projectRoot}/plastex-venv/bin/plastex"
|
|
||||||
|
|
||||||
def discordHook = "https://discord.com/api/webhooks/1456391390513856676/yniOv0Gbxp2UwW1pbZcekpXsC8y1dYppGQ90O7He-df24IODggrgXdMFwvz-RMWM15j8"
|
|
||||||
|
|
||||||
pipeline {
|
|
||||||
agent any
|
|
||||||
|
|
||||||
stages {
|
|
||||||
stage('Create Links') {
|
|
||||||
steps {
|
|
||||||
dir("${projectRoot}/gerby-website/gerby/tools/") {
|
|
||||||
sh 'rm ./document || true'
|
|
||||||
sh 'rm ./document.paux || true'
|
|
||||||
sh 'rm ./tags || true'
|
|
||||||
sh 'ln -s ../../../document document'
|
|
||||||
sh 'ln -s ../../../document.paux document.paux'
|
|
||||||
sh 'ln -s ../../../tags tags'
|
|
||||||
}
|
|
||||||
dir("${projectRoot}/gerby-website/") {
|
|
||||||
sh 'rm ./hello-world.sqlite || true'
|
|
||||||
sh 'rm ./comments.sqlite || true'
|
|
||||||
sh 'ln -s gerby/tools/hello-world.sqlite hello-world.sqlite'
|
|
||||||
sh 'ln -s gerby/tools/comments.sqlite comments.sqlite'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Bibliography') {
|
|
||||||
steps {
|
|
||||||
dir("${projectRoot}/") {
|
|
||||||
sh 'pdflatex -interaction=nonstopmode document.tex || true'
|
|
||||||
sh 'bibtex document || true'
|
|
||||||
sh 'pdflatex -interaction=nonstopmode document.tex || true'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Delete Tags') {
|
|
||||||
when {
|
|
||||||
expression { params['Redo Tags'] == true }
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
dir("${projectRoot}/") {
|
|
||||||
sh 'rm ./tags || true'
|
|
||||||
sh 'rm ./gerby-website/gerby/tools/hello-world.sqlite || true'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// The document folder is needed for the website to run, hence it is not cleared at the end of the compile process.
|
|
||||||
stage('Delete Previous Build') {
|
|
||||||
steps {
|
|
||||||
dir("${projectRoot}/") {
|
|
||||||
sh "rm -r ./document"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Tag') {
|
|
||||||
steps {
|
|
||||||
dir("${projectRoot}/") {
|
|
||||||
sh "${vGPython} tagger.py >> tags"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Plastex') {
|
|
||||||
steps {
|
|
||||||
dir("${projectRoot}/") {
|
|
||||||
sh "${vPlastex} --renderer=Gerby ./document.tex"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Update Database') {
|
|
||||||
steps {
|
|
||||||
dir("${projectRoot}/gerby-website/gerby/tools") {
|
|
||||||
sh "${vGPython} update.py"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
always {
|
|
||||||
dir("${projectRoot}/") {
|
|
||||||
sh 'rm document.aux || true'
|
|
||||||
sh 'rm document.bbl || true'
|
|
||||||
sh 'rm document.blg || true'
|
|
||||||
sh 'rm document.log || true'
|
|
||||||
sh 'rm document.out || true'
|
|
||||||
sh 'rm document.pdf || true'
|
|
||||||
}
|
|
||||||
script {
|
|
||||||
def formatTime = { milliseconds ->
|
|
||||||
long seconds = (long)(milliseconds / 1000)
|
|
||||||
long mins = (long)(seconds / 60)
|
|
||||||
long secs = seconds % 60
|
|
||||||
return mins > 0 ? "${mins}m${secs}s" : "${secs}s"
|
|
||||||
}
|
|
||||||
|
|
||||||
def buildTitle = "Build Website #${env.BUILD_NUMBER}"
|
|
||||||
if (params['Redo Tags']) {
|
|
||||||
buildTitle += " (Retag)"
|
|
||||||
}
|
|
||||||
|
|
||||||
def queueTimeMs = currentBuild.startTimeInMillis - currentBuild.timeInMillis
|
|
||||||
def queueTime = formatTime(queueTimeMs)
|
|
||||||
def buildTime = formatTime(currentBuild.duration)
|
|
||||||
|
|
||||||
def description = """
|
|
||||||
**Build:** [#${env.BUILD_NUMBER}](${env.BUILD_URL})
|
|
||||||
**Console:** [Console Output](${env.BUILD_URL}console)
|
|
||||||
|
|
||||||
**Queue Time:** ${queueTime}
|
|
||||||
**Build Duration:** ${buildTime}
|
|
||||||
**Status:** ${currentBuild.currentResult}
|
|
||||||
""".trim()
|
|
||||||
|
|
||||||
discordSend(
|
|
||||||
webhookURL: discordHook,
|
|
||||||
title: buildTitle,
|
|
||||||
description: description,
|
|
||||||
result: currentBuild.currentResult
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
22
build.sh
22
build.sh
@@ -1,22 +0,0 @@
|
|||||||
rm -r ./document
|
|
||||||
|
|
||||||
# Make the bibliography. Errors here don't matter.
|
|
||||||
pdflatex -interaction=nonstopmode document.tex > /dev/null 2>&1
|
|
||||||
bibtex document > /dev/null 2>&1
|
|
||||||
pdflatex -interaction=nonstopmode document.tex > /dev/null 2>&1
|
|
||||||
|
|
||||||
|
|
||||||
# Website compilation procedure
|
|
||||||
python3 tagger.py >> tags
|
|
||||||
./plastex-venv/bin/plastex --renderer=Gerby ./document.tex
|
|
||||||
cd ./gerby-website/gerby/tools
|
|
||||||
python3 update.py
|
|
||||||
cd ../../..
|
|
||||||
|
|
||||||
# Clean up the tex compilations.
|
|
||||||
rm document.aux > /dev/null 2>&1
|
|
||||||
rm document.bbl > /dev/null 2>&1
|
|
||||||
rm document.blg > /dev/null 2>&1
|
|
||||||
rm document.log > /dev/null 2>&1
|
|
||||||
rm document.out > /dev/null 2>&1
|
|
||||||
rm document.pdf > /dev/null 2>&1
|
|
||||||
15
gerby.code-workspace
Normal file
15
gerby.code-workspace
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"VsCodeTaskButtons.tasks": [
|
||||||
|
{
|
||||||
|
"label": "Watch",
|
||||||
|
"task": "Watch"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
5
retag.sh
5
retag.sh
@@ -1,5 +0,0 @@
|
|||||||
# Rebuilds the tag system. Requires administrative access.
|
|
||||||
|
|
||||||
rm ./tags
|
|
||||||
rm ./gerby-website/gerby/tools/hello-world.sqlite
|
|
||||||
./build.sh
|
|
||||||
@@ -12,3 +12,5 @@ font = "roboto"
|
|||||||
primaryColour = "blue"
|
primaryColour = "blue"
|
||||||
neutralColour = "grey"
|
neutralColour = "grey"
|
||||||
searchLimit = 16
|
searchLimit = 16
|
||||||
|
maxSearchPages = 48
|
||||||
|
advertiseSpec = true
|
||||||
|
|||||||
73
tagger.py
73
tagger.py
@@ -1,73 +0,0 @@
|
|||||||
import glob
|
|
||||||
import re
|
|
||||||
|
|
||||||
# no I, no O
|
|
||||||
CHARACTERS = "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ"
|
|
||||||
|
|
||||||
|
|
||||||
# convert integer to tag
|
|
||||||
def tobase(i):
|
|
||||||
global CHARACTERS
|
|
||||||
|
|
||||||
assert i >= 0
|
|
||||||
|
|
||||||
if i < len(CHARACTERS):
|
|
||||||
return CHARACTERS[i]
|
|
||||||
else:
|
|
||||||
return tobase(i // len(CHARACTERS)) + CHARACTERS[i % len(CHARACTERS)]
|
|
||||||
|
|
||||||
|
|
||||||
def totag(i):
|
|
||||||
return tobase(i).rjust(4, "0")
|
|
||||||
|
|
||||||
|
|
||||||
# convert tag to integer
|
|
||||||
def toint(tag):
|
|
||||||
global CHARACTERS
|
|
||||||
return sum(
|
|
||||||
[CHARACTERS.index(tag[i]) * len(CHARACTERS) ** (4 - i - 1) for i in range(4)]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
tags = dict()
|
|
||||||
labels = dict()
|
|
||||||
inactive = []
|
|
||||||
|
|
||||||
try:
|
|
||||||
with open("tags") as f:
|
|
||||||
for line in f:
|
|
||||||
# actual tag
|
|
||||||
if not line.startswith("#"):
|
|
||||||
tags[line.split(",")[0]] = line.strip().split(",")[1]
|
|
||||||
labels[line.strip().split(",")[1]] = line.strip().split(",")[0]
|
|
||||||
|
|
||||||
# check for inactive tags too
|
|
||||||
elif len(line.split(",")) == 2 and len(line.split(",")[0]) == 4:
|
|
||||||
inactive.append(line.split(",")[0])
|
|
||||||
|
|
||||||
except FileNotFoundError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# determine last assigned tag
|
|
||||||
try:
|
|
||||||
last = toint(sorted(list(tags.keys()) + inactive)[-1])
|
|
||||||
except IndexError:
|
|
||||||
last = -1
|
|
||||||
|
|
||||||
|
|
||||||
filenames = glob.glob("./src/**/*.tex", recursive=True) + ["document.tex"]
|
|
||||||
# filenames = ["document.tex"]
|
|
||||||
|
|
||||||
# where we should start
|
|
||||||
i = last + 1
|
|
||||||
|
|
||||||
for filename in filenames:
|
|
||||||
with open(filename) as f:
|
|
||||||
# do this line per line to deal with comments
|
|
||||||
for line in f:
|
|
||||||
matches = re.findall("\\\\label{([^}]+)}", line.split("%")[0])
|
|
||||||
for label in matches:
|
|
||||||
if not label in labels:
|
|
||||||
tag = tobase(i).rjust(4, "0")
|
|
||||||
print("%s,%s" % (tag, label))
|
|
||||||
i = i + 1
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
ssh gerby@178.156.199.217 "rm -r /home/gerby/gerby/gerby-website"
|
|
||||||
ssh gerby@178.156.199.217 "rm -r /home/gerby/gerby/plastex"
|
|
||||||
|
|
||||||
rsync -avz gerby-website plastex gerby@178.156.199.217:/home/gerby/gerby
|
|
||||||
11
upload.sh
11
upload.sh
@@ -1,11 +0,0 @@
|
|||||||
ssh gerby@178.156.199.217 "rm /home/gerby/gerby/document.tex"
|
|
||||||
ssh gerby@178.156.199.217 "rm /home/gerby/gerby/preamble.sty"
|
|
||||||
ssh gerby@178.156.199.217 "rm -r /home/gerby/gerby/src"
|
|
||||||
rsync -avz preamble.sty document.tex src gerby@178.156.199.217:/home/gerby/gerby
|
|
||||||
|
|
||||||
USER="jerrylicious"
|
|
||||||
API_TOKEN="1199813d21c0022313bd9e7c8fa98d47b0"
|
|
||||||
BUILD_TOKEN="AAAAC3NzaC1lZDI1NTE5AAAAIBlYjedLVBgIxxutWbnFm0bgs87jswTfhgOfGaPzzqTZ"
|
|
||||||
|
|
||||||
CRUMB=$(curl -s "https://$USER:$API_TOKEN@jenkins.jerrylicious.me/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\" ,//crumb)")
|
|
||||||
curl -X POST -H "$CRUMB" "https://$USER:$API_TOKEN@jenkins.jerrylicious.me/job/Gerby/job/Build%20Project/buildWithParameters?token=$BUILD_TOKEN&Redo%20Tags=false"
|
|
||||||
Reference in New Issue
Block a user