Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Apple M1 #322

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 114 additions & 75 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,27 @@ name: CI build
on:
push:
branches:
- master
- master
pull_request:
branches:
- master

- master

# Global Settings
env:
PYTHON_VERSION: "3.7"
GODOT_BINARY_VERSION: "3.2.3"


jobs:


static-checks:
name: '📊 Static checks'
name: "📊 Static checks"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
with:
submodules: true
submodules: true
- name: Set up Python
uses: actions/setup-python@0291cefc54fa79cd1986aee8fa5ecb89ad4defea # pin@v2
uses: actions/setup-python@0291cefc54fa79cd1986aee8fa5ecb89ad4defea # pin@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Bootstrap
Expand All @@ -38,26 +34,24 @@ jobs:
run: |
pre-commit run --all-files --show-diff-on-failure


#################################################################################

#################################################################################

linux-build:
name: '🐧 Linux build'
name: "🐧 Linux build"
runs-on: ubuntu-latest
env:
CC: clang
PLATFORM: 'x11-64'
PLATFORM: "x11-64"
steps:
- name: 'Checkout'
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
- name: "Checkout"
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
with:
submodules: true
- name: 'Set up Python'
uses: actions/setup-python@0291cefc54fa79cd1986aee8fa5ecb89ad4defea # pin@v2
submodules: true
- name: "Set up Python"
uses: actions/setup-python@0291cefc54fa79cd1986aee8fa5ecb89ad4defea # pin@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: 'Setup venv'
- name: "Setup venv"
run: |
set -eux
${{ env.CC }} --version
Expand All @@ -68,57 +62,55 @@ jobs:
echo 'godot_binary = "${{ env.GODOT_BINARY_VERSION }}"' >> custom.py
echo 'platform = "${{ env.PLATFORM }}"' >> custom.py
echo 'CC = "${{ env.CC }}"' >> custom.py
- name: 'Build project'
- name: "Build project"
run: |
set -eux
scons build -j2
- name: 'Start xvfb'
- name: "Start xvfb"
run: |
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
echo ">>> Started xvfb"
- name: 'Run tests'
- name: "Run tests"
run: |
set -eux
scons tests headless=true
env:
DISPLAY: ':99.0'
- name: 'Generate artifact archive'
DISPLAY: ":99.0"
- name: "Generate artifact archive"
run: |
set -eux
scons release
- name: 'Export release artifact'
uses: actions/upload-artifact@11830c9f4d30053679cb8904e3b3ce1b8c00bf40 # pin@v2
- name: "Export release artifact"
uses: actions/upload-artifact@11830c9f4d30053679cb8904e3b3ce1b8c00bf40 # pin@v2
with:
name: ${{ env.PLATFORM }}-release
path: 'build/godot-python-*.tar.bz2'


#################################################################################
path: "build/godot-python-*.tar.bz2"

#################################################################################

windows-build:
name: '🏁 Windows build'
name: "🏁 Windows build"
runs-on: windows-latest
strategy:
matrix:
include:
- PLATFORM: 'windows-64'
PYTHON_ARCH: 'x64'
VS_ARCH: 'amd64'
- PLATFORM: 'windows-32'
PYTHON_ARCH: 'x86'
VS_ARCH: 'x86'
- PLATFORM: "windows-64"
PYTHON_ARCH: "x64"
VS_ARCH: "amd64"
- PLATFORM: "windows-32"
PYTHON_ARCH: "x86"
VS_ARCH: "x86"
steps:
- name: 'Checkout'
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
- name: "Checkout"
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
with:
submodules: true
- name: 'Set up Python'
uses: actions/setup-python@0291cefc54fa79cd1986aee8fa5ecb89ad4defea # pin@v2
submodules: true
- name: "Set up Python"
uses: actions/setup-python@0291cefc54fa79cd1986aee8fa5ecb89ad4defea # pin@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: ${{ matrix.PYTHON_ARCH }}
- name: 'Setup venv'
- name: "Setup venv"
shell: bash
run: |
set -eux
Expand All @@ -131,12 +123,12 @@ jobs:
echo 'MSVC_USE_SCRIPT = True' >> custom.py
echo 'TARGET_ARCH = "${{ matrix.VS_ARCH }}"' >> custom.py
echo 'CC = "cl.exe"' >> custom.py
- name: 'Build project'
- name: "Build project"
shell: bash
run: |
set -eux
scons build -j2
- name: 'Install Mesa3D OpenGL'
- name: "Install Mesa3D OpenGL"
shell: bash
run: |
set -eux
Expand All @@ -153,41 +145,39 @@ jobs:
7z.exe x mesa.7z
ls -lh opengl32.dll # Sanity check
popd
- name: 'Run tests'
- name: "Run tests"
shell: bash
run: |
set -eux
scons tests
- name: 'Generate artifact archive'
- name: "Generate artifact archive"
shell: bash
run: |
scons release
- name: 'Export release artifact'
uses: actions/upload-artifact@11830c9f4d30053679cb8904e3b3ce1b8c00bf40 # pin@v2
- name: "Export release artifact"
uses: actions/upload-artifact@11830c9f4d30053679cb8904e3b3ce1b8c00bf40 # pin@v2
with:
name: ${{ matrix.PLATFORM }}-release
path: 'build/godot-python-*.zip'


#################################################################################
path: "build/godot-python-*.zip"

#################################################################################

macos-build:
name: '🍎 macOS build'
macos-intel-build:
name: "🍎 macOS/intel build"
runs-on: macos-latest
env:
CC: clang
PLATFORM: 'osx-64'
PLATFORM: "osx-64"
steps:
- name: 'Checkout'
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
- name: "Checkout"
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
with:
submodules: true
- name: 'Set up Python'
uses: actions/setup-python@0291cefc54fa79cd1986aee8fa5ecb89ad4defea # pin@v2
submodules: true
- name: "Set up Python"
uses: actions/setup-python@0291cefc54fa79cd1986aee8fa5ecb89ad4defea # pin@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: 'Setup venv'
- name: "Setup venv"
run: |
set -eux
${{ env.CC }} --version
Expand All @@ -201,30 +191,79 @@ jobs:
echo 'godot_binary = "${{ env.GODOT_BINARY_VERSION }}"' >> custom.py
echo 'platform = "${{ env.PLATFORM }}"' >> custom.py
echo 'CC = "${{ env.CC }}"' >> custom.py
- name: 'Build project'
- name: "Build project"
run: |
set -eux
scons build -j2
- name: 'Run tests'
- name: "Run tests"
run: |
set -eux
scons tests
- name: 'Generate artifact archive'
- name: "Generate artifact archive"
run: |
set -eux
scons release
- name: 'Export release artifact'
uses: actions/upload-artifact@11830c9f4d30053679cb8904e3b3ce1b8c00bf40 # pin@v2
- name: "Export release artifact"
uses: actions/upload-artifact@11830c9f4d30053679cb8904e3b3ce1b8c00bf40 # pin@v2
with:
name: ${{ env.PLATFORM }}-release
path: 'build/godot-python-*.tar.bz2'
path: "build/godot-python-*.tar.bz2"

#################################################################################

#################################################################################
macos-m1-build:
name: "🍏 macOS/m1 build"
runs-on: macos-latest
env:
CC: clang
PLATFORM: "osx-arm"
ARCH: "arm64"
steps:
- name: "Checkout"
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
with:
submodules: true
- name: "Set up Python"
uses: actions/setup-python@0291cefc54fa79cd1986aee8fa5ecb89ad4defea # pin@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: "Setup venv"
run: |
set -eux
${{ env.CC }} --version
python --version
brew update
brew install zlib openssl
brew install --cask xquartz
pip install -U pip
pip install -r requirements.txt
# Configuration for scons
echo 'godot_binary = "${{ env.GODOT_BINARY_VERSION }}"' >> custom.py
echo 'platform = "${{ env.PLATFORM }}"' >> custom.py
echo 'arch = "${{ env.ARCH }}"' >> custom.py
echo 'CC = "${{ env.CC }}"' >> custom.py
- name: "Build project"
run: |
set -eux
scons build -j2
# - name: 'Run tests'
# run: |
# set -eux
# scons tests
- name: "Generate artifact archive"
run: |
set -eux
scons release
- name: "Export release artifact"
uses: actions/upload-artifact@11830c9f4d30053679cb8904e3b3ce1b8c00bf40 # pin@v2
with:
name: ${{ env.PLATFORM }}-{{ env.ARCH }}-release
path: "build/godot-python-*.tar.bz2"

#################################################################################

publish-release:
name: 'Publish ${{ matrix.PLATFORM }} release'
name: "Publish ${{ matrix.PLATFORM }} release"
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs:
Expand All @@ -239,10 +278,10 @@ jobs:
- PLATFORM: windows-32
- PLATFORM: osx-64
steps:
- uses: actions/download-artifact@0ede0875b5db9a2824878bbbbe3d758a75eb8268 # pin@v2
- uses: actions/download-artifact@0ede0875b5db9a2824878bbbbe3d758a75eb8268 # pin@v2
name: ${{ matrix.PLATFORM }}-release
- name: 'Upload release'
uses: svenstaro/upload-release-action@483c1e56f95e88835747b1c7c60581215016cbf2 # pin@v2
- name: "Upload release"
uses: svenstaro/upload-release-action@483c1e56f95e88835747b1c7c60581215016cbf2 # pin@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ For MacOS:

godot-python(venv)$ scons platform=osx-64 CC=clang release

Valid platforms are `x11-64`, `x11-32`, `windows-64`, `windows-32` and `osx-64`.
Valid platforms are `x11-64`, `x11-32`, `windows-64`, `windows-32`, `osx-64`, and `osx-arm`.
Check Travis or Appveyor links above to see the current status of your platform.

This command will checkout CPython repo, move to a pinned commit and build
Expand Down
3 changes: 2 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ vars.Add(
"platform",
"Target platform",
"",
allowed_values=("x11-64", "x11-32", "windows-64", "windows-32", "osx-64"),
allowed_values=("x11-64", "x11-32", "windows-64", "windows-32", "osx-64", "osx-arm"),
)
)
vars.Add("arch", "Platform-dependent architecture (arm/arm64/x86/x64/mips/...)", allowed_values=("x86_64", "arm64"))
vars.Add("pytest_args", "Pytest arguments passed to tests functions", "")
vars.Add(
"godot_args", "Additional arguments passed to godot binary when running tests&examples", ""
Expand Down
1 change: 1 addition & 0 deletions misc/release_pythonscript.gdnlib
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Server.64="res://addons/pythonscript/x11-64/libpythonscript.so"
Windows.64="res://addons/pythonscript/windows-64/pythonscript.dll"
Windows.32="res://addons/pythonscript/windows-32/pythonscript.dll"
OSX.64="res://addons/pythonscript/osx-64/libpythonscript.dylib"
OSX="res://addons/pythonscript/osx/libpythonscript.dylib"

[dependencies]

Expand Down
Loading