From ad876a4bd99d494d624f3b810f4eac46ab1df66c Mon Sep 17 00:00:00 2001 From: Emmanuel Leblond Date: Sun, 26 Mar 2023 22:01:48 +0200 Subject: [PATCH] Fix CI --- .github/workflows/build.yml | 65 +++++++++++------------- meson.build | 13 ++++- scripts/extension_api_parser/__main__.py | 8 +-- 3 files changed, 44 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7bbab6b0..e47d0d54 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,8 +65,6 @@ jobs: python --version pip install -U pip pip install -r requirements.in - - name: 'Sanity check on extension_api_parser' - run: python -m scripts.extension_api_parser - name: 'Setup project' run: python .github/scripts/meson_setup_or_dump_log.py build/ - name: 'Build project' @@ -98,11 +96,9 @@ jobs: - PLATFORM: 'windows-x86_64' PYTHON_ARCH: 'x64' MSVC_ARCH: 'x64' - GODOT_BINARY_HINT: '' - PLATFORM: 'windows-x86' PYTHON_ARCH: 'x86' MSVC_ARCH: 'x86' - GODOT_BINARY_HINT: 'x86:' steps: - name: 'Checkout' uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0 @@ -132,9 +128,9 @@ jobs: shell: bash run: | set -eux - python tests/run.py 0-gdscript --build-dir build/ --godot-binary=${{ matrix.GODOT_BINARY_HINT }} -- --headless - python tests/run.py 1-gdextension --build-dir build/ --godot-binary=${{ matrix.GODOT_BINARY_HINT }} -- --headless - python tests/run.py 2-pythonscript-init --build-dir build/ --godot-binary=${{ matrix.GODOT_BINARY_HINT }} -- --headless + python tests/run.py 0-gdscript --build-dir build/ -- --headless + python tests/run.py 1-gdextension --build-dir build/ -- --headless + python tests/run.py 2-pythonscript-init --build-dir build/ -- --headless # - name: 'Install Mesa3D OpenGL' # shell: bash # run: | @@ -166,33 +162,34 @@ jobs: ################################################################################# - macos-build: - name: '🍎 macOS build' - runs-on: macos-latest - env: - CC: clang - LD: lld - PLATFORM: 'macos-x86_64' - steps: - - name: 'Checkout' - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0 - with: - submodules: true - - name: 'Set up Python' - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # pin@v4.5.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: 'Setup venv' - run: | - set -eux - ${{ env.CC }} --version - python --version - pip install -U pip - pip install -r requirements.txt - - name: 'Setup project' - run: python .github/scripts/meson_setup_or_dump_log.py build/ - - name: 'Build project' - run: meson compile -C build/ +# TODO + # macos-build: + # name: '🍎 macOS build' + # runs-on: macos-latest + # env: + # CC: clang + # LD: lld + # PLATFORM: 'macos-x86_64' + # steps: + # - name: 'Checkout' + # uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0 + # with: + # submodules: true + # - name: 'Set up Python' + # uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # pin@v4.5.0 + # with: + # python-version: ${{ env.PYTHON_VERSION }} + # - name: 'Setup venv' + # run: | + # set -eux + # ${{ env.CC }} --version + # python --version + # pip install -U pip + # pip install -r requirements.txt + # - name: 'Setup project' + # run: python .github/scripts/meson_setup_or_dump_log.py build/ + # - name: 'Build project' + # run: meson compile -C build/ # TODO: see https://github.com/touilleMan/godot-python/issues/358 # - name: 'Run tests' # run: python tests/run.py 0-pythonscript-init --build-dir build/ -- --headless diff --git a/meson.build b/meson.build index 37715f0e..baeb20c2 100644 --- a/meson.build +++ b/meson.build @@ -248,20 +248,29 @@ if get_option('gdextension_path') != '' gdextension_path = join_paths(meson.project_source_root(), get_option('gdextension_path')) else # Download Godot and generate it GDextension API + message('Fetching Godot v@0@ binary and generating GDExtension...'.format(get_option('godot_version'))) run_command( python, 'scripts/fetch_godot.py', '--generate-gdextension', '--build-dir', meson.project_build_root(), get_option('godot_version'), - capture: true, check: true, - ).stdout().strip().split('\n') + ) gdextension_path = join_paths(meson.project_build_root(), 'gdextension_api') endif godot_extension_api_json = join_paths(gdextension_path, 'extension_api.json') +# Sanity check on extension_api_parser +message('Checking GDExtension\'s extension_api.json is supported...'.format(get_option('godot_version'))) +run_command( + python, + '-m', + 'scripts.extension_api_parser', + godot_extension_api_json, + check: true, +) # On Windows `/MDd` flag (used by meson when `buildtype=debug`) defines `_DEBUG`, diff --git a/scripts/extension_api_parser/__main__.py b/scripts/extension_api_parser/__main__.py index 5885f2e2..7a399aa5 100644 --- a/scripts/extension_api_parser/__main__.py +++ b/scripts/extension_api_parser/__main__.py @@ -13,11 +13,7 @@ try: extension_api_path = Path(sys.argv[1]) except IndexError: - extension_api_path = ( - (Path(__file__).parent / "../../godot_headers/extension_api.json") - .resolve() - .relative_to(os.getcwd()) - ) + raise SystemExit("Usage: python -m extension_api_parser ") try: @@ -29,6 +25,6 @@ for build_config in build_configs: initial_types_db = TYPES_DB.copy() print(f"Checking {extension_api_path} with config {build_config.value}") - parse_extension_api_json(extension_api_path, build_config, skip_classes=False) + parse_extension_api_json(extension_api_path, build_config, filter_classes=False) TYPES_DB.clear() TYPES_DB.update(initial_types_db)