Skip to content

Commit

Permalink
feat: test Python 3.9 and above (#40)
Browse files Browse the repository at this point in the history
* feat: run CI across python 3.9-3.12

* add note about minimum 3.9

* update cmd files to check for min python version
  • Loading branch information
cheahjs committed Jan 26, 2024
1 parent d990450 commit ba27427
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 15 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/premerge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ jobs:
tests:
name: Python tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12
python-version: ${{ matrix.python-version }}
- name: Run tests
run: |
python -m unittest tests/rawdata.py
python -m unittest tests/*.py
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Please follow the instructions provided over at https://github.com/xNul/palworld
### Prerequisites

1. Python. This can be installed from the Windows Store.
1. Python 3.9 or newer. You can install [Python 3.12 from the Microsoft Store](https://apps.microsoft.com/detail/9NCVDN91XZQP)

### Windows steps

Expand Down
22 changes: 16 additions & 6 deletions convenience_tools/convert-single-json-to-sav.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,38 @@ pause
exit /B 1

:Found
@REM Print Python version for debugging
:: Print Python version for debugging
ECHO Python version:
%PYTHON_BIN% --version

@REM Switch to script directory
:: Check that the minor version of python is at least 9.
FOR /F "tokens=1,2 delims=." %%G IN ('%PYTHON_BIN% --version') DO (
SET PYTHON_VERSION_MINOR=%%H
)

IF %PYTHON_VERSION_MINOR% LSS 9 (
ECHO Python 3.9 or higher is required.
EXIT /B 1
)

:: Switch to script directory
cd /D "%~dp0"

@REM Check if convert-single-json-to-sav.py exists
:: Check if convert-single-json-to-sav.py exists
IF NOT EXIST "convert-single-json-to-sav.py" (
ECHO convert-single-json-to-sav.py is missing.
PAUSE
EXIT /B 1
)

@REM Check if first argument exists
:: Check if first argument exists
IF NOT EXIST "%~1" (
ECHO You must specify a .sav file to convert.
PAUSE
EXIT /B 1
)

@REM Check if uesave.exe exists
:: Check if uesave.exe exists
IF NOT EXIST "uesave/uesave.exe" (
ECHO uesave.exe is missing. Did you download the palworld-save-tools.zip from releases?
MKDIR uesave
Expand All @@ -48,7 +58,7 @@ IF NOT EXIST "uesave/uesave.exe" (
ECHO This will convert the save file "%~1" in JSON format in back to .sav format.
ECHO This will overwrite your existing .sav file!
ECHO Please make a backup of your .sav file before continuing!
@REM Ask user if they want to continue
:: Ask user if they want to continue
CHOICE /C YN /M "Continue?"
IF %ERRORLEVEL% NEQ 1 (
ECHO Exiting because aborted.
Expand Down
21 changes: 15 additions & 6 deletions convenience_tools/convert-single-sav-to-json.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,38 @@ pause
exit /B 1

:Found
@REM Print Python version for debugging
:: Print Python version for debugging
ECHO Python version:
%PYTHON_BIN% --version

@REM Switch to script directory
:: Check that the minor version of python is at least 9.
FOR /F "tokens=1,2 delims=." %%G IN ('%PYTHON_BIN% --version') DO (
SET PYTHON_VERSION_MINOR=%%H
)

IF %PYTHON_VERSION_MINOR% LSS 9 (
ECHO Python 3.9 or higher is required.
EXIT /B 1
)

:: Switch to script directory
cd /D "%~dp0"

@REM Check if convert-single-sav-to-json.py exists
:: Check if convert-single-sav-to-json.py exists
IF NOT EXIST "convert-single-sav-to-json.py" (
ECHO convert-single-sav-to-json.py is missing.
PAUSE
EXIT /B 1
)

@REM Check if first argument exists
:: Check if first argument exists
IF NOT EXIST "%~1" (
ECHO You must specify a .sav file to convert.
PAUSE
EXIT /B 1
)

@REM Check if uesave.exe exists
:: Check if uesave.exe exists
IF NOT EXIST "uesave/uesave.exe" (
ECHO uesave.exe is missing. Did you download the palworld-save-tools.zip from releases?
MKDIR uesave
Expand All @@ -46,7 +56,6 @@ IF NOT EXIST "uesave/uesave.exe" (
)

ECHO This will convert the save file "%~1" to JSON format.
@REM Ask user if they want to continue
CHOICE /C YN /M "Continue?"
IF %ERRORLEVEL% NEQ 1 (
ECHO Exiting because aborted.
Expand Down

0 comments on commit ba27427

Please sign in to comment.