Update pr-validation.yml #1657
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR/Commit validation of FPSLocker Patches | |
| on: | |
| pull_request: | |
| branches: | |
| - v4 | |
| push: | |
| branches: | |
| - v4 | |
| workflow_dispatch: | |
| jobs: | |
| validate-patches: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout PR branch | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up GCC and build tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential gcc g++ | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.14' | |
| - name: Clone FPSLocker repository | |
| run: | | |
| git clone https://github.com/masagrator/FPSLocker.git FPSLocker | |
| - name: Clone SaltyNX repository | |
| run: | | |
| git clone https://github.com/masagrator/SaltyNX.git SaltyNX | |
| - name: Build FPSLocker tester | |
| env: | |
| SALTYNX_PATH: ${{ github.workspace }}/SaltyNX | |
| run: | | |
| cd FPSLocker/tester | |
| python run.py | |
| - name: Verify my_program executable exists | |
| run: | | |
| if [ ! -f "FPSLocker/tester/my_program" ]; then | |
| echo "Error: my_program executable not found" | |
| exit 1 | |
| fi | |
| - name: Find and validate all YAML patch files | |
| run: | | |
| PATCH_DIR="${GITHUB_WORKSPACE}/SaltySD/plugins/FPSLocker/patches" | |
| EXECUTABLE="${GITHUB_WORKSPACE}/FPSLocker/tester/my_program" | |
| if [ ! -d "$PATCH_DIR" ]; then | |
| echo "Error: Patches directory not found at $PATCH_DIR" | |
| exit 1 | |
| fi | |
| TOTAL=0 | |
| FAILED=0 | |
| FAILED_LIST="" | |
| # The tester writes test.bin next to the CWD, so give it a scratch dir. | |
| WORKDIR="$(mktemp -d)" | |
| cd "$WORKDIR" | |
| while IFS= read -r yaml_file; do | |
| TOTAL=$((TOTAL + 1)) | |
| filename=$(basename "$yaml_file" .yaml) | |
| problem="" | |
| # Compile the patch, then load and apply it through SaltyNX's patcher. | |
| if ! output=$("$EXECUTABLE" "$yaml_file" 2>&1); then | |
| problem="patch validation failed" | |
| # The build ID must appear in the file, preceded by a space. | |
| elif ! grep -q " $filename" "$yaml_file"; then | |
| problem="build ID '$filename' not found in the file" | |
| output="" | |
| fi | |
| if [ -n "$problem" ]; then | |
| FAILED=$((FAILED + 1)) | |
| rel="${yaml_file#$GITHUB_WORKSPACE/}" | |
| echo "::error file=$rel::$problem" | |
| echo "FAIL $rel - $problem" | |
| if [ -n "$output" ]; then | |
| echo "$output" | sed 's/^/ /' | |
| fi | |
| FAILED_LIST="${FAILED_LIST}- \`$rel\` - $problem"$'\n' | |
| fi | |
| done < <(find "$PATCH_DIR" -type f -name "*.yaml" | sort) | |
| PASSED=$((TOTAL - FAILED)) | |
| echo | |
| echo "Validated $TOTAL patch file(s): $PASSED passed, $FAILED failed" | |
| { | |
| echo "## FPSLocker patch validation" | |
| echo | |
| echo "| Result | Count |" | |
| echo "| --- | ---: |" | |
| echo "| Passed | $PASSED |" | |
| echo "| Failed | $FAILED |" | |
| echo "| Total | $TOTAL |" | |
| if [ "$FAILED" -ne 0 ]; then | |
| echo | |
| echo "### Failures" | |
| echo | |
| printf '%s' "$FAILED_LIST" | |
| fi | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| if [ "$FAILED" -ne 0 ]; then | |
| exit 1 | |
| fi | |
| echo "All patch files validated successfully" |