workflow: Add Python 3.9 to GitHub CI workflow

Closes #1054
This commit is contained in:
Derzsi Dániel 2020-11-23 10:58:23 +01:00 committed by rdb
parent 54cb519dc9
commit 862d06b7a8
2 changed files with 102 additions and 12 deletions

View File

@ -198,7 +198,7 @@ jobs:
shell: bash
run: >
cmake -DWANT_PYTHON_VERSION=3.6
-DPython_FIND_REGISTRY=NEVER -DPython_ROOT=$pythonLocation .
-DPython_FIND_REGISTRY=NEVER -DPython_ROOT="$pythonLocation" .
- name: Build (Python 3.6)
if: contains(matrix.python, 'YES')
# BEGIN A
@ -230,7 +230,7 @@ jobs:
shell: bash
run: >
cmake -DWANT_PYTHON_VERSION=3.7
-DPython_FIND_REGISTRY=NEVER -DPython_ROOT=$pythonLocation .
-DPython_FIND_REGISTRY=NEVER -DPython_ROOT="$pythonLocation" .
- name: Build (Python 3.7)
if: contains(matrix.python, 'YES')
# BEGIN A
@ -262,7 +262,7 @@ jobs:
shell: bash
run: >
cmake -DWANT_PYTHON_VERSION=3.8
-DPython_FIND_REGISTRY=NEVER -DPython_ROOT=$pythonLocation .
-DPython_FIND_REGISTRY=NEVER -DPython_ROOT="$pythonLocation" .
- name: Build (Python 3.8)
if: contains(matrix.python, 'YES')
# BEGIN A
@ -283,6 +283,38 @@ jobs:
$PYTHON_EXECUTABLE -m pytest ../tests --cov=.
# END B
- name: Setup Python (Python 3.9)
if: contains(matrix.python, 'YES')
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Configure (Python 3.9)
if: contains(matrix.python, 'YES')
working-directory: build
shell: bash
run: >
cmake -DWANT_PYTHON_VERSION=3.9
-DPython_FIND_REGISTRY=NEVER -DPython_ROOT="$pythonLocation" .
- name: Build (Python 3.9)
if: contains(matrix.python, 'YES')
# BEGIN A
working-directory: build
run: cmake --build . --config ${{ matrix.config }} --parallel 4
# END A
- name: Test (Python 3.9)
# BEGIN B
if: contains(matrix.python, 'YES')
working-directory: build
shell: bash
env:
PYTHONPATH: ${{ matrix.config }}
run: |
PYTHON_EXECUTABLE=$(grep 'Python_EXECUTABLE:' CMakeCache.txt | sed 's/.*=//')
$PYTHON_EXECUTABLE -m pip install pytest pytest-cov
export COVERAGE_FILE=.coverage.$RANDOM LLVM_PROFILE_FILE=$PWD/pid-%p.profraw
$PYTHON_EXECUTABLE -m pytest ../tests --cov=.
# END B
- name: Upload coverage reports
if: always() && matrix.config == 'Coverage'
working-directory: build
@ -329,13 +361,27 @@ jobs:
mv panda3d-1.10.7/thirdparty thirdparty
rmdir panda3d-1.10.7
(cd thirdparty/darwin-libs-a && rm -rf rocket)
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Build Python 3.9
shell: bash
run: |
python makepanda/makepanda.py --git-commit=${{github.sha}} --outputdir=built --everything --no-eigen --python-incdir="$pythonLocation/include" --python-libdir="$pythonLocation/lib" --verbose --threads=4
- name: Test Python 3.9
shell: bash
run: |
python -m pip install pytest
PYTHONPATH=built LD_LIBRARY_PATH=built/lib DYLD_LIBRARY_PATH=built/lib python -m pytest
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Build Python 3.8
shell: bash
run: |
python makepanda/makepanda.py --git-commit=${{github.sha}} --outputdir=built --everything --no-eigen --python-incdir=$pythonLocation/include --python-libdir=$pythonLocation/lib --verbose --threads=4
python makepanda/makepanda.py --git-commit=${{github.sha}} --outputdir=built --everything --no-eigen --python-incdir="$pythonLocation/include" --python-libdir="$pythonLocation/lib" --verbose --threads=4
- name: Test Python 3.8
shell: bash
run: |
@ -346,8 +392,9 @@ jobs:
with:
python-version: 3.7
- name: Build Python 3.7
shell: bash
run: |
python makepanda/makepanda.py --git-commit=${{github.sha}} --outputdir=built --everything --no-eigen --python-incdir=$pythonLocation/include --python-libdir=$pythonLocation/lib --verbose --threads=4
python makepanda/makepanda.py --git-commit=${{github.sha}} --outputdir=built --everything --no-eigen --python-incdir="$pythonLocation/include" --python-libdir="$pythonLocation/lib" --verbose --threads=4
- name: Test Python 3.7
shell: bash
run: |

View File

@ -2038,6 +2038,13 @@ def SdkLocatePython(prefer_thirdparty_python=False):
abiflags = getattr(sys, 'abiflags', '')
if GetTarget() == 'windows':
if PkgHasCustomLocation("PYTHON"):
# Check our custom location instead (--python-libdir, --python-incdir)
sdkdir = FindOptDirectory("PYTHON")
if sdkdir is None:
exit("Could not find a Python installation using these command line options.")
else:
sdkdir = GetThirdpartyBase() + "/win-python"
sdkdir += "%d.%d" % sys.version_info[:2]
@ -2046,8 +2053,10 @@ def SdkLocatePython(prefer_thirdparty_python=False):
if GetTargetArch() == 'x64':
sdkdir += "-x64"
sdkdir = sdkdir.replace('\\', '/')
SDK["PYTHON"] = sdkdir
SDK["PYTHONEXEC"] = SDK["PYTHON"].replace('\\', '/') + "/python"
SDK["PYTHONEXEC"] = SDK["PYTHON"] + "/python"
if (GetOptimize() <= 2):
SDK["PYTHONEXEC"] += "_d.exe"
else:
@ -2745,6 +2754,40 @@ def LibDirectory(opt, dir):
def FrameworkDirectory(opt, dir):
FRAMEWORKDIRECTORIES.append((opt, dir))
def FindIncDirectory(opt):
# Find the include directory associated with this module
for mod, dir in INCDIRECTORIES:
if mod == opt:
return os.path.abspath(dir)
def FindLibDirectory(opt):
# Find the library directory associated with this module
for mod, dir in LIBDIRECTORIES:
if mod == opt:
return os.path.abspath(dir)
def FindOptDirectory(opt):
# Find the common directory associated with this module
# using the include and library directories as a guide
include_dir = FindIncDirectory(opt)
lib_dir = FindLibDirectory(opt)
if include_dir and lib_dir:
# The module's common directory is the common prefix of
# its include and library directory
common_dir = os.path.commonprefix([include_dir, lib_dir])
if common_dir:
return os.path.abspath(common_dir)
elif include_dir:
# The module's common directory is the parent of the include
# directory
return os.path.abspath(os.path.join(include_dir, os.pardir))
elif lib_dir:
# The module's common directory is the parent of the library
# directory
return os.path.abspath(os.path.join(lib_dir, os.pardir))
def LibName(opt, name):
# Check to see if the lib file actually exists for the thirdparty library given
# Are we a thirdparty library?