Fix: test failure on pull request from dependabot (#2783)

# Description of Changes

This PR is the first step for improving `Generate verification metadata`

---

## Checklist

### General

- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### UI Changes (if applicable)

- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [x] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
This commit is contained in:
Ludy 2025-01-25 15:06:45 +01:00 committed by GitHub
parent 0631e3071c
commit 1d016df92e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 77 additions and 39 deletions

View File

@ -37,6 +37,12 @@ jobs:
java-version: ${{ matrix.jdk-version }} java-version: ${{ matrix.jdk-version }}
distribution: "temurin" distribution: "temurin"
- name: PR | Generate verification metadata with signatures and checksums for dependabot[bot]
if: github.event.pull_request.user.login == 'dependabot[bot]'
run: |
./gradlew clean dependencies buildEnvironment spotlessApply --write-verification-metadata sha256 --refresh-dependencies help
./gradlew clean dependencies buildEnvironment spotlessApply --write-verification-metadata sha256,pgp --refresh-keys --export-keys --refresh-dependencies help
- name: Build with Gradle and no spring security - name: Build with Gradle and no spring security
run: ./gradlew clean build run: ./gradlew clean build
env: env:
@ -95,7 +101,7 @@ jobs:
- name: Install Docker Compose - name: Install Docker Compose
run: | run: |
sudo curl -SL "https://github.com/docker/compose/releases/download/v2.32.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo curl -SL "https://github.com/docker/compose/releases/download/v2.32.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
- name: Set up Python - name: Set up Python
@ -112,4 +118,4 @@ jobs:
run: | run: |
chmod +x ./cucumber/test_webpages.sh chmod +x ./cucumber/test_webpages.sh
chmod +x ./test.sh chmod +x ./test.sh
./test.sh ./test.sh "${{ github.event.pull_request.user.login == 'dependabot[bot]' }}"

View File

@ -1,12 +1,17 @@
name: Sync Files name: Sync Files
on: on:
workflow_dispatch:
push: push:
branches: branches:
- main - main
paths: paths:
- "build.gradle" - "build.gradle"
- "README.md"
- "gradle/verification-keyring.keys"
- "gradle/verification-metadata.xml"
- "src/main/resources/messages_*.properties" - "src/main/resources/messages_*.properties"
- "src/main/resources/static/3rdPartyLicenses.json"
- "scripts/ignore_translation.toml" - "scripts/ignore_translation.toml"
permissions: permissions:
@ -84,21 +89,37 @@ jobs:
- name: Run git add - name: Run git add
run: | run: |
git add . git add src/main/resources/messages_*.properties
git diff --staged --quiet || git commit -m ":memo: Sync translation files" || echo "no changes" git diff --staged --quiet || git commit -m ":memo: Sync translation files" || echo "no changes"
- name: Install dependencies - name: Install dependencies
run: pip install --require-hashes -r ./.github/scripts/requirements_sync_readme.txt run: pip install --require-hashes -r ./.github/scripts/requirements_sync_readme.txt
- name: Sync README - name: Sync README.md
run: | run: |
python scripts/counter_translation.py python scripts/counter_translation.py
- name: Run git add - name: Run git add
run: | run: |
git add . git add README.md
git diff --staged --quiet || git commit -m ":memo: Sync README.md" || echo "no changes" git diff --staged --quiet || git commit -m ":memo: Sync README.md" || echo "no changes"
- name: Generate verification metadata with signatures and checksums
run: |
set -e
if [ -f ./gradle/verification-metadata.xml ]; then
rm ./gradle/verification-metadata.xml
fi
./gradlew clean dependencies buildEnvironment spotlessApply --write-verification-metadata sha256 help
./gradlew clean dependencies buildEnvironment spotlessApply --write-verification-metadata sha256,pgp --refresh-keys --export-keys --refresh-dependencies help
./gradlew clean build
- name: Run git add
run: |
git add gradle/verification-keyring.keys
git add gradle/verification-metadata.xml
git diff --staged --quiet || git commit -m ":memo: Generate verification metadata with signatures and checksums" || echo "no changes"
- name: Create Pull Request - name: Create Pull Request
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6 uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
with: with:
@ -108,28 +129,42 @@ 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: ":memo: Sync translation files + Update README.md (Translation Progress Table)" title: ":globe_with_meridians: Sync Translations + Update README Progress Table + Update Verification Metadata"
body: | body: |
#### Description ### Description of Changes
This Pull Request was automatically generated to synchronize updates to translation files and documentation. The changes include: 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 content based on the latest changes in `messages_en_GB.properties`. - Updated translation files (`messages_*.properties`) to reflect changes in the reference file `messages_en_GB.properties`.
- Ensured consistency between all language files and the reference file. - Ensured consistency and synchronization across all supported language files.
- Highlighted any missing or incomplete translations.
2. **Update README.md:** #### **2. Update README.md**
- Generated the translation progress table. - Generated the translation progress table in `README.md`.
- Displayed the current status of translations for all supported languages. - Added a summary of the current translation status for all supported languages.
- Included up-to-date statistics on translation coverage.
#### **3. Verification Metadata Updates**
- Generated or refreshed the `verification-keyring.keys` and `verification-metadata.xml` files.
- Included the latest dependency signatures and checksums to enhance the build's integrity.
#### **Why these changes are necessary**
- Keeps translation files aligned with the latest reference updates.
- Ensures the documentation reflects the current translation progress.
- Strengthens dependency verification for a more secure build process.
--- ---
Auto-generated by [create-pull-request][1]
Auto-generated by [create-pull-request][1].
[1]: https://github.com/peter-evans/create-pull-request [1]: https://github.com/peter-evans/create-pull-request
draft: false draft: false
delete-branch: true delete-branch: true
labels: Documentation,Translation,github-actions labels: github-actions
sign-commits: true sign-commits: true
add-paths: | add-paths: |
README.md README.md
src/main/resources/messages_*.properties src/main/resources/messages_*.properties
gradle/verification-keyring.keys
gradle/verification-metadata.xml

View File

@ -25,11 +25,6 @@ repos:
rev: v8.22.0 rev: v8.22.0
hooks: hooks:
- id: gitleaks - id: gitleaks
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shellcheck
files: ^.*(\.bash|\.sh|\.ksh|\.zsh)$
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0 rev: v5.0.0
hooks: hooks:

28
test.sh
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
# Function to check the health of the service with a timeout of 80 seconds # Function to check the health of the service with a timeout of 80 seconds
check_health() { check_health() {
local service_name=$1 local service_name=$1
@ -64,8 +67,13 @@ run_tests() {
main() { main() {
SECONDS=0 SECONDS=0
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 [[ "$VERIFICATION" == "true" ]]; then
./gradlew clean dependencies buildEnvironment spotlessApply --write-verification-metadata sha256 --refresh-dependencies help
./gradlew clean dependencies buildEnvironment spotlessApply --write-verification-metadata sha256,pgp --refresh-keys --export-keys --refresh-dependencies help
fi
export DOCKER_ENABLE_SECURITY=false
if ! ./gradlew clean build; then if ! ./gradlew clean build; then
echo "Gradle build failed with security disabled, exiting script." echo "Gradle build failed with security disabled, exiting script."
exit 1 exit 1
@ -89,7 +97,6 @@ main() {
docker-compose -f "./exampleYmlFiles/docker-compose-latest-ultra-lite.yml" down docker-compose -f "./exampleYmlFiles/docker-compose-latest-ultra-lite.yml" down
#run_tests "Stirling-PDF" "./exampleYmlFiles/docker-compose-latest.yml" #run_tests "Stirling-PDF" "./exampleYmlFiles/docker-compose-latest.yml"
#docker-compose -f "./exampleYmlFiles/docker-compose-latest.yml" down #docker-compose -f "./exampleYmlFiles/docker-compose-latest.yml" down
@ -100,18 +107,16 @@ 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/test_cicd.yml" run_tests "Stirling-PDF-Security-Fat" "./exampleYmlFiles/test_cicd.yml"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
@ -146,8 +151,6 @@ main() {
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."
@ -156,7 +159,6 @@ main() {
echo "All tests passed successfully." echo "All tests passed successfully."
exit 0 exit 0
fi fi
} }
main main