Compare commits

..

1 Commits

Author SHA1 Message Date
Anthony Stirling
5790ea8c01 Update sync_files.yml 2025-02-04 10:41:41 +00:00
15 changed files with 117 additions and 107 deletions

View File

@@ -141,4 +141,4 @@ jobs:
run: | run: |
chmod +x ./testing/test_webpages.sh chmod +x ./testing/test_webpages.sh
chmod +x ./testing/test.sh chmod +x ./testing/test.sh
./testing/test.sh ./testing/test.sh "${{ github.event.pull_request.user.login == 'dependabot[bot]' }}"

View File

@@ -38,7 +38,7 @@ jobs:
java-version: "17" java-version: "17"
distribution: "adopt" distribution: "adopt"
- uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0 - uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
- name: check the licenses for compatibility - name: check the licenses for compatibility
run: ./gradlew clean checkLicense run: ./gradlew clean checkLicense

View File

@@ -63,7 +63,7 @@ jobs:
java-version: "21" java-version: "21"
distribution: "temurin" distribution: "temurin"
- uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0 - uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
with: with:
gradle-version: 8.12 gradle-version: 8.12
@@ -151,7 +151,7 @@ jobs:
java-version: "21" java-version: "21"
distribution: "temurin" distribution: "temurin"
- uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0 - uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
with: with:
gradle-version: 8.12 gradle-version: 8.12

View File

@@ -30,7 +30,7 @@ jobs:
java-version: "17" java-version: "17"
distribution: "temurin" distribution: "temurin"
- uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0 - uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
with: with:
gradle-version: 8.12 gradle-version: 8.12

View File

@@ -35,7 +35,7 @@ jobs:
java-version: "17" java-version: "17"
distribution: "temurin" distribution: "temurin"
- uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0 - uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
with: with:
gradle-version: 8.12 gradle-version: 8.12

View File

@@ -31,6 +31,20 @@ jobs:
java-version: '17' java-version: '17'
distribution: 'temurin' distribution: 'temurin'
- name: Cache SonarCloud packages
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build and analyze with Gradle - name: Build and analyze with Gradle
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -26,7 +26,7 @@ jobs:
java-version: "17" java-version: "17"
distribution: "temurin" distribution: "temurin"
- uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0 - uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
- name: Generate Swagger documentation - name: Generate Swagger documentation
run: ./gradlew generateOpenApiDocs run: ./gradlew generateOpenApiDocs

View File

@@ -111,11 +111,11 @@ jobs:
author: ${{ needs.read_bot_entries.outputs.committer }} author: ${{ needs.read_bot_entries.outputs.committer }}
signoff: true signoff: true
branch: sync_readme branch: sync_readme
title: ":globe_with_meridians: Sync Translations + Update README Progress Table" title: ":globe_with_meridians: Sync Translations + Update README Progress Table + Update Verification Metadata"
body: | body: |
### Description of Changes ### Description of Changes
This Pull Request was automatically generated to synchronize updates to translation files and documentation. Below are the details of the changes made: This Pull Request was automatically generated to synchronize updates to translation files, verification metadata, and documentation. Below are the details of the changes made:
#### **1. Synchronization of Translation Files** #### **1. Synchronization of Translation Files**
- Updated translation files (`messages_*.properties`) to reflect changes in the reference file `messages_en_GB.properties`. - Updated translation files (`messages_*.properties`) to reflect changes in the reference file `messages_en_GB.properties`.

View File

@@ -8,7 +8,7 @@ plugins {
id "com.diffplug.spotless" version "7.0.2" id "com.diffplug.spotless" version "7.0.2"
id "com.github.jk1.dependency-license-report" version "2.9" id "com.github.jk1.dependency-license-report" version "2.9"
//id "nebula.lint" version "19.0.3" //id "nebula.lint" version "19.0.3"
id("org.panteleyev.jpackageplugin") version "1.6.1" id("org.panteleyev.jpackageplugin") version "1.6.0"
id "org.sonarqube" version "6.0.1.5171" id "org.sonarqube" version "6.0.1.5171"
} }
@@ -26,7 +26,7 @@ ext {
} }
group = "stirling.software" group = "stirling.software"
version = "0.40.2" version = "0.40.1"
java { java {
// 17 is lowest but we support and recommend 21 // 17 is lowest but we support and recommend 21

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 145 KiB

View File

@@ -44,7 +44,7 @@ public class ConvertHtmlToPDF {
@Operation( @Operation(
summary = "Convert an HTML or ZIP (containing HTML and CSS) to PDF", summary = "Convert an HTML or ZIP (containing HTML and CSS) to PDF",
description = description =
"This endpoint takes an HTML or ZIP file input and converts it to a PDF format. Input:HTML Output:PDF Type:SISO") "This endpoint takes an HTML or ZIP file input and converts it to a PDF format.")
public ResponseEntity<byte[]> HtmlToPdf(@ModelAttribute HTMLToPdfRequest request) public ResponseEntity<byte[]> HtmlToPdf(@ModelAttribute HTMLToPdfRequest request)
throws Exception { throws Exception {
MultipartFile fileInput = request.getFileInput(); MultipartFile fileInput = request.getFileInput();

View File

@@ -8,7 +8,7 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import io.swagger.v3.oas.annotations.Operation;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import org.apache.pdfbox.multipdf.PDFMergerUtility; import org.apache.pdfbox.multipdf.PDFMergerUtility;
@@ -65,9 +65,6 @@ public class OCRController {
} }
@PostMapping(consumes = "multipart/form-data", value = "/ocr-pdf") @PostMapping(consumes = "multipart/form-data", value = "/ocr-pdf")
@Operation(
summary = "Process PDF files with OCR using Tesseract",
description = "Takes a PDF file as input, performs OCR using specified languages and OCR type (skip-text/force-ocr), and returns the processed PDF. Input:PDF Output:PDF Type:SISO")
public ResponseEntity<byte[]> processPdfWithOCR( public ResponseEntity<byte[]> processPdfWithOCR(
@ModelAttribute ProcessPdfWithOcrRequest request) @ModelAttribute ProcessPdfWithOcrRequest request)
throws IOException, InterruptedException { throws IOException, InterruptedException {

View File

@@ -218,9 +218,6 @@ public class ProcessExecutor {
errorReaderThread.join(); errorReaderThread.join();
outputReaderThread.join(); outputReaderThread.join();
boolean isQpdf =
command != null && !command.isEmpty() && command.get(0).contains("qpdf");
if (outputLines.size() > 0) { if (outputLines.size() > 0) {
String outputMessage = String.join("\n", outputLines); String outputMessage = String.join("\n", outputLines);
messages += outputMessage; messages += outputMessage;
@@ -236,28 +233,20 @@ public class ProcessExecutor {
log.warn("Command error output:\n" + errorMessage); log.warn("Command error output:\n" + errorMessage);
} }
if (exitCode != 0) { if (exitCode != 0) {
if (isQpdf && exitCode == 3) { throw new IOException(
log.warn("qpdf succeeded with warnings: {}", messages); "Command process failed with exit code "
} else { + exitCode
throw new IOException( + ". Error message: "
"Command process failed with exit code " + errorMessage);
+ exitCode
+ ". Error message: "
+ errorMessage);
}
} }
} }
if (exitCode != 0) { if (exitCode != 0) {
if (isQpdf && exitCode == 3) { throw new IOException(
log.warn("qpdf succeeded with warnings: {}", messages); "Command process failed with exit code "
} else { + exitCode
throw new IOException( + "\nLogs: "
"Command process failed with exit code " + messages);
+ exitCode
+ "\nLogs: "
+ messages);
}
} }
} finally { } finally {
semaphore.release(); semaphore.release();

View File

@@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
# Default value for the Boolean parameter
VERIFICATION=${1:-false} # Default is "false" if no parameter is passed
# Find project root by locating build.gradle # Find project root by locating build.gradle
find_root() { find_root() {
local dir="$PWD" local dir="$PWD"
@@ -23,18 +26,18 @@ check_health() {
local end=$((SECONDS+60)) local end=$((SECONDS+60))
echo -n "Waiting for $service_name to become healthy..." echo -n "Waiting for $service_name to become healthy..."
until [ "$(docker inspect --format='{{json .State.Health.Status}}' "$service_name")" == '"healthy"' ] || [ $SECONDS -ge $end ]; do until [ "$(docker inspect --format='{{json .State.Health.Status}}' "$service_name")" == '"healthy"' ] || [ $SECONDS -ge $end ]; do
sleep 3 sleep 3
echo -n "." echo -n "."
if [ $SECONDS -ge $end ]; then if [ $SECONDS -ge $end ]; then
echo -e "\n$service_name health check timed out after 80 seconds." echo -e "\n$service_name health check timed out after 80 seconds."
echo "Printing logs for $service_name:" echo "Printing logs for $service_name:"
docker logs "$service_name" docker logs "$service_name"
return 1 return 1
fi fi
done done
echo -e "\n$service_name is healthy!" echo -e "\n$service_name is healthy!"
echo "Printing logs for $service_name:" echo "Printing logs for $service_name:"
docker logs "$service_name" docker logs "$service_name"
return 0 return 0
} }
@@ -78,10 +81,10 @@ run_tests() {
# Main testing routine # Main testing routine
main() { main() {
SECONDS=0 SECONDS=0
cd "$PROJECT_ROOT" cd "$PROJECT_ROOT"
export DOCKER_ENABLE_SECURITY=false export DOCKER_ENABLE_SECURITY=false
# Run the gradlew build command and check if it fails # Run the gradlew build command and check if it fails
if ! ./gradlew clean build; then if ! ./gradlew clean build; then
@@ -89,26 +92,28 @@ main() {
exit 1 exit 1
fi fi
# Building Docker images # Building Docker images
# docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest -f ./Dockerfile . # docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest -f ./Dockerfile .
docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest-ultra-lite -f ./Dockerfile.ultra-lite . docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest-ultra-lite -f ./Dockerfile.ultra-lite .
# Test each configuration # Test each configuration
run_tests "Stirling-PDF-Ultra-Lite" "./exampleYmlFiles/docker-compose-latest-ultra-lite.yml" run_tests "Stirling-PDF-Ultra-Lite" "./exampleYmlFiles/docker-compose-latest-ultra-lite.yml"
echo "Testing webpage accessibility..."
cd "testing"
if ./test_webpages.sh -f webpage_urls.txt -b http://localhost:8080; then
passed_tests+=("Webpage-Accessibility-lite")
else
failed_tests+=("Webpage-Accessibility-lite")
echo "Webpage accessibility lite tests failed"
fi
cd "$PROJECT_ROOT"
docker-compose -f "./exampleYmlFiles/docker-compose-latest-ultra-lite.yml" down
echo "Testing webpage accessibility..." #run_tests "Stirling-PDF" "./exampleYmlFiles/docker-compose-latest.yml"
cd "testing" #docker-compose -f "./exampleYmlFiles/docker-compose-latest.yml" down
if ./test_webpages.sh -f webpage_urls.txt -b http://localhost:8080; then
passed_tests+=("Webpage-Accessibility-lite")
else
failed_tests+=("Webpage-Accessibility-lite")
echo "Webpage accessibility lite tests failed"
fi
cd "$PROJECT_ROOT"
docker-compose -f "./exampleYmlFiles/docker-compose-latest-ultra-lite.yml" down
# run_tests "Stirling-PDF" "./exampleYmlFiles/docker-compose-latest.yml"
# docker-compose -f "./exampleYmlFiles/docker-compose-latest.yml" down
export DOCKER_ENABLE_SECURITY=true export DOCKER_ENABLE_SECURITY=true
# Run the gradlew build command and check if it fails # Run the gradlew build command and check if it fails
@@ -117,68 +122,72 @@ main() {
exit 1 exit 1
fi fi
# Building Docker images with security enabled # Building Docker images with security enabled
# docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest -f ./Dockerfile . # docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest -f ./Dockerfile .
# docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest-ultra-lite -f ./Dockerfile.ultra-lite . # docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest-ultra-lite -f ./Dockerfile.ultra-lite .
docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest-fat -f ./Dockerfile.fat . docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest-fat -f ./Dockerfile.fat .
# Test each configuration with security # Test each configuration with security
# run_tests "Stirling-PDF-Ultra-Lite-Security" "./exampleYmlFiles/docker-compose-latest-ultra-lite-security.yml" # run_tests "Stirling-PDF-Ultra-Lite-Security" "./exampleYmlFiles/docker-compose-latest-ultra-lite-security.yml"
# docker-compose -f "./exampleYmlFiles/docker-compose-latest-ultra-lite-security.yml" down #docker-compose -f "./exampleYmlFiles/docker-compose-latest-ultra-lite-security.yml" down
# run_tests "Stirling-PDF-Security" "./exampleYmlFiles/docker-compose-latest-security.yml" # run_tests "Stirling-PDF-Security" "./exampleYmlFiles/docker-compose-latest-security.yml"
# docker-compose -f "./exampleYmlFiles/docker-compose-latest-security.yml" down # docker-compose -f "./exampleYmlFiles/docker-compose-latest-security.yml" down
run_tests "Stirling-PDF-Security-Fat" "./exampleYmlFiles/docker-compose-latest-fat-security.yml" run_tests "Stirling-PDF-Security-Fat" "./exampleYmlFiles/docker-compose-latest-fat-security.yml"
echo "Testing webpage accessibility..."
cd "testing"
if ./test_webpages.sh -f webpage_urls_full.txt -b http://localhost:8080; then
passed_tests+=("Webpage-Accessibility-full")
else
failed_tests+=("Webpage-Accessibility-full")
echo "Webpage accessibility full tests failed"
fi
cd "$PROJECT_ROOT"
docker-compose -f "./exampleYmlFiles/docker-compose-latest-fat-security.yml" down
echo "Testing webpage accessibility..."
cd "testing"
if ./test_webpages.sh -f webpage_urls_full.txt -b http://localhost:8080; then
passed_tests+=("Webpage-Accessibility-full")
else
failed_tests+=("Webpage-Accessibility-full")
echo "Webpage accessibility full tests failed"
fi
cd "$PROJECT_ROOT"
docker-compose -f "./exampleYmlFiles/docker-compose-latest-fat-security.yml" down run_tests "Stirling-PDF-Security-Fat-with-login" "./exampleYmlFiles/test_cicd.yml"
run_tests "Stirling-PDF-Security-Fat-with-login" "./exampleYmlFiles/test_cicd.yml"
if [ $? -eq 0 ]; then
cd "testing/cucumber"
if python -m behave; then
passed_tests+=("Stirling-PDF-Regression")
else
failed_tests+=("Stirling-PDF-Regression")
echo "Printing docker logs of failed regression"
docker logs "Stirling-PDF-Security-Fat-with-login"
echo "Printed docker logs of failed regression"
fi
cd "$PROJECT_ROOT"
fi
docker-compose -f "./exampleYmlFiles/test_cicd.yml" down
if [ $? -eq 0 ]; then
cd "testing/cucumber"
if python -m behave; then
passed_tests+=("Stirling-PDF-Regression")
else
failed_tests+=("Stirling-PDF-Regression")
echo "Printing docker logs of failed regression"
docker logs "Stirling-PDF-Security-Fat-with-login"
echo "Printed docker logs of failed regression"
fi
cd "$PROJECT_ROOT"
fi
docker-compose -f "./exampleYmlFiles/test_cicd.yml" down
# Report results # Report results
echo "All tests completed in $SECONDS seconds." echo "All tests completed in $SECONDS seconds."
if [ ${#passed_tests[@]} -ne 0 ]; then if [ ${#passed_tests[@]} -ne 0 ]; then
echo "Passed tests:" echo "Passed tests:"
fi fi
for test in "${passed_tests[@]}"; do for test in "${passed_tests[@]}"; do
echo -e "\e[32m$test\e[0m" # Green color for passed tests echo -e "\e[32m$test\e[0m" # Green color for passed tests
done done
if [ ${#failed_tests[@]} -ne 0 ]; then if [ ${#failed_tests[@]} -ne 0 ]; then
echo "Failed tests:" echo "Failed tests:"
fi fi
for test in "${failed_tests[@]}"; do for test in "${failed_tests[@]}"; do
echo -e "\e[31m$test\e[0m" # Red color for failed tests echo -e "\e[31m$test\e[0m" # Red color for failed tests
done done
# Check if there are any failed tests and exit with an error code if so # Check if there are any failed tests and exit with an error code if so
if [ ${#failed_tests[@]} -ne 0 ]; then if [ ${#failed_tests[@]} -ne 0 ]; then
echo "Some tests failed." echo "Some tests failed."
@@ -187,6 +196,7 @@ main() {
echo "All tests passed successfully." echo "All tests passed successfully."
exit 0 exit 0
fi fi
} }
main main