Skip to content

Commit 7a0386b

Browse files
authored
Fix compile workflow (#157)
## Pull Request: Enhancements and Fixes for Compile Workflow This pull request introduces a series of enhancements and bug fixes aimed at improving the reliability and efficiency of the compile workflow. **Key improvements:** * **Resolved Build Failure (Temporary Fix Only):** A function impacting the build workflow has been temporarily disabled to ensure successful compilation. ⚠️ **This is a temporary workaround and requires a permanent solution before release.** ⚠️ Pls See #154 for more details * **Dependency Updates:** * Updated `checkout` and `texlive` actions to the lates release * Updated the `texlive` version to the latest release * **Fixed LaTeX Parsing:** Resolved an issue related to the parsing of LaTeX escape characters, ensuring accurate interpretation and rendering of special symbols * **File Management:** * Corrected a missing file dependency and rectified an instance of file misnaming * Refactored file names to fit the new project structure * Rectified a misspelled folder name * Added empty dummy files that have not yet been written or restructured * Rewrote the `.gitignore` file to exclude compiled artifacts and IDE-generated folders * **Test Workflow:** * Automated Tests through a workflow. * First test checks the links for: * is the URL still up/valid * Is it an https link instead of a http link * is the presented certificate valid ## Important Notice for People writing branches If you are working on other branches, please ensure you update your local branch with the changes from this pull request **before** continuing your work. This will prevent potential conflicts and ensure consistency across the project. You can update your branch using the following commands: ```bash git switch <your_branch_name> git rebase origin/fix_compile_workflow ```
1 parent ee3f40a commit 7a0386b

30 files changed

Lines changed: 338 additions & 140 deletions

.github/workflows/build.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build and Run Tests
2+
3+
on:
4+
push: {}
5+
workflow_dispatch: {}
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 30
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
- uses: xu-cheng/texlive-action@v2
15+
with:
16+
scheme: full # Consider changing to 'basic' or 'medium' if possible
17+
run: |
18+
apk add make
19+
apk add g++
20+
apk add zip
21+
make script zip
22+
- uses: actions/upload-artifact@v4
23+
with:
24+
name: PDF_Test
25+
path: vorkurs.pdf
26+
27+
check-links:
28+
runs-on: ubuntu-latest
29+
needs: build
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
34+
- name: Download compiled PDF
35+
uses: actions/download-artifact@v4
36+
with:
37+
name: PDF_Test
38+
path: .
39+
40+
- name: Install pdfgrep
41+
run: sudo apt-get update && sudo apt-get install -y pdfgrep
42+
43+
- name: Extract and Check URLs
44+
run: |
45+
urls=$(pdfgrep -o -P 'https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)' vorkurs.pdf | sort -u)
46+
error_count=0
47+
48+
for url in $urls; do
49+
echo "Checking URL: $url"
50+
51+
if [[ ! "$url" =~ ^https:// ]]; then
52+
echo "ERROR: URL is not HTTPS: $url"
53+
error_count=$((error_count + 1))
54+
continue
55+
fi
56+
57+
if ! curl -Isf --fail-early --connect-timeout 10 "$url" > /dev/null 2>&1; then
58+
curl_error=$(curl -Isf --fail-early --connect-timeout 10 "$url" 2>&1 > /dev/null)
59+
if [[ $curl_error == *"Failed to connect"* ]]; then
60+
echo "ERROR: Connection failed: $url"
61+
elif [[ $curl_error == *"Could not resolve host"* ]]; then
62+
echo "ERROR: DNS resolution failed: $url"
63+
elif [[ $curl_error == *"SSL certificate problem"* ]]; then
64+
echo "ERROR: Initial SSL certificate problem: $url"
65+
else
66+
echo "ERROR: Failed to access: $url (curl error: $curl_error)"
67+
fi
68+
if ! openssl s_client -connect "$(echo "$url" | sed 's/https\?:\/\///' | cut -d/ -f1):443" -servername "$(echo "$url" | sed 's/https\?:\/\///' | cut -d/ -f1)" 2>/dev/null </dev/null | openssl x509 -noout; then
69+
echo " -> CERTIFICATE ERROR DETECTED!"
70+
fi
71+
72+
error_count=$((error_count + 1))
73+
fi
74+
done
75+
76+
if [ "$error_count" -gt 0 ]; then
77+
echo "::error::Found $error_count broken or insecure links!"
78+
exit 1
79+
fi
80+
shell: bash

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ vorkurs/
1717
vorkurs.zip
1818
pool_setup/poolpw
1919
title.pdf
20+
.vscode/
21+
.DS_Store
22+
*.dSYM

appendix/cheatsheet_shellcomands.tex

Whitespace-only changes.

appendix/cheatsheet_shortcuts.tex

Whitespace-only changes.

appendix/error_messages.tex

Whitespace-only changes.

appendix/intro.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ \chapter{Appendix}
33

44

55
\pagestyle{fancy}
6-
\input{appendix/cheatsheet_shortcuts}
7-
\input{appendix/cheatsheet_shellcomands}
8-
\input{appendix/coding_style}
9-
\input{appendix/fehler_fehlermeldungen}
6+
\input{appendix/cheatsheet_shortcuts} %ToDo needs to be added
7+
\input{appendix/cheatsheet_shellcomands} % ToDo needs to be added
8+
\input{appendix/coding_style} %ToDo, partially done
9+
\input{appendix/error_messages} % ToDo needs to be added
1010

1111
\clearpage
1212
\pagestyle{empty}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ \chapter{Vorbereitung eigener Computer}
55
Wir werden in diesem Fall den proprietären Editor „Visual Studio Code“ verwenden, welcher \href{https://code.visualstudio.com/Download}{hier} heruntergeladen werden kann.\\
66

77
\pagestyle{fancy}
8-
\input{eigene_computer/windows.tex}
9-
\input{eigene_computer/macos.tex}
10-
\input{eigene_computer/linux.tex}
8+
\input{eigener_computer/linux}
9+
\input{eigener_computer/windows}
10+
\input{eigener_computer/macos}

0 commit comments

Comments
 (0)