diff --git a/.github/ci_path_filters.yaml b/.github/ci_path_filters.yaml index 6db4b2ac6e0..ca01600f4b3 100644 --- a/.github/ci_path_filters.yaml +++ b/.github/ci_path_filters.yaml @@ -52,15 +52,19 @@ internal: &internal api_cpp: - 'api/cpp/**' - 'tools/compiler/**' + - *ci_config api_python: - 'api/python/**' + - *ci_config api_node: - 'api/node/**' + - *ci_config api_rs: - 'api/rs/**' + - *ci_config tests: - 'tests/**' diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a542d176988..4a0b3373d46 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -79,106 +79,53 @@ jobs: save_if: ${{ matrix.save_if }} timeout_minutes: 120 - node_test: + # For changes to Slint internals, do a quick test on Linux for Node.js only. + node_test_linux: needs: files-changed if: needs.files-changed.outputs.internal == 'true' || needs.files-changed.outputs.api_node == 'true' || needs.files-changed.outputs.tests == 'true' - env: - RUSTFLAGS: -D warnings - CARGO_PROFILE_DEV_DEBUG: 0 - CARGO_INCREMENTAL: false - RUST_BACKTRACE: 1 - strategy: - matrix: - os: [ubuntu-22.04, macos-14, windows-2022] - - runs-on: ${{ matrix.os }} + uses: ./.github/workflows/node_test_reusable.yaml + with: + name: "Node.js Linux" + os: "ubuntu-22.04" - steps: - - uses: actions/checkout@v5 - - uses: ./.github/actions/install-linux-dependencies - - uses: ./.github/actions/install-skia-dependencies - - name: Setup headless display - if: runner.os != 'macOS' - uses: pyvista/setup-headless-display-action@v4 - - uses: actions/setup-node@v6 - with: - node-version: 20 - package-manager-cache: false - id: node-install - - uses: pnpm/action-setup@v4.2.0 - with: - version: 10.18.2 - - uses: ./.github/actions/setup-rust - with: - key: x-napi-v2-${{ steps.node-install.outputs.node-version }} # the cache key consists of a manually bumpable version and the node version, as the cached rustc artifacts contain linking information where to find node.lib, which is in a versioned directory. - - name: Run pnpm install - working-directory: api/node - run: pnpm install --frozen-lockfile - - name: Build node plugin in debug - run: pnpm build:testing - working-directory: api/node - - name: Run node tests - working-directory: api/node - run: pnpm test - - name: Run test-driver-nodejs - # Release is only applied to the harness that drives the node.js invocations, but needed - # to avoid crashing on Windows with what looks like an out of stack exception. - run: cargo test --verbose --release --all-features -p test-driver-nodejs - - name: Check image-filter example - working-directory: examples/imagefilter/node - run: pnpm check - - python_test: + node_test_macos: needs: files-changed - if: needs.files-changed.outputs.internal == 'true' || needs.files-changed.outputs.api_python == 'true' || needs.files-changed.outputs.tests == 'true' - env: - DYLD_FRAMEWORK_PATH: /Users/runner/work/slint/Qt/5.15.2/clang_64/lib - QT_QPA_PLATFORM: offscreen - RUSTFLAGS: -D warnings - CARGO_PROFILE_DEV_DEBUG: 0 - CARGO_INCREMENTAL: false - RUST_BACKTRACE: full - SLINT_BACKEND: winit - strategy: - matrix: - os: [ubuntu-22.04, macos-14, windows-2022] + if: needs.files-changed.outputs.api_node == 'true' || needs.files-changed.outputs.tests == 'true' + uses: ./.github/workflows/node_test_reusable.yaml + with: + name: "Node.js macOS" + os: "macos-14" - runs-on: ${{ matrix.os }} + node_test_windows: + needs: files-changed + if: needs.files-changed.outputs.api_node == 'true' || needs.files-changed.outputs.tests == 'true' + uses: ./.github/workflows/node_test_reusable.yaml + with: + name: "Node.js Windows" + os: "windows-2022" - steps: - - uses: actions/checkout@v5 - - uses: ./.github/actions/install-linux-dependencies - - name: Install Qt - if: runner.os == 'Linux' - uses: jurplel/install-qt-action@v4 - with: - version: "5.15.2" - setup-python: false - cache: true - - name: Setup headless display - if: runner.os != 'macOS' - uses: pyvista/setup-headless-display-action@v4 - - uses: ./.github/actions/setup-rust - with: - key: x-napi-v2-${{ steps.node-install.outputs.node-version }} # the cache key consists of a manually bumpable version and the node version, as the cached rustc artifacts contain linking information where to find node.lib, which is in a versioned directory. - - uses: actions/setup-python@v6 - with: - python-version: "3.12" - - name: Install uv - uses: astral-sh/setup-uv@v7 - - uses: fjwillemsen/setup-nox2@v3.0.0 - - name: Run python tests - working-directory: api/python/slint - run: nox --default-venv-backend uv - - name: Run mypy - working-directory: api/python/slint - run: uv run mypy -p tests -p slint - - name: Run ruff linter - working-directory: api/python/slint - run: uv tool run ruff check - - name: Run ruff linter - working-directory: api/python/briefcase - run: uv tool run ruff check + # For changes to Slint internals, do a quick test on Linux for Python only. + python_test_linux: + needs: files-changed + if: needs.files-changed.outputs.internal == 'true' || needs.files-changed.outputs.api_python == 'true' + uses: ./.github/workflows/python_test_reusable.yaml + with: + name: "Python Linux" + os: "ubuntu-22.04" + python_test_macos: + needs: files-changed + if: needs.files-changed.outputs.api_python == 'true' + uses: ./.github/workflows/python_test_reusable.yaml + with: + name: "Python macOS" + os: "macos-14" + python_test_windows: + needs: files-changed + if: needs.files-changed.outputs.api_python == 'true' + uses: ./.github/workflows/python_test_reusable.yaml + with: + name: "Python Windows" + os: "windows-2022" cpp_test_driver: needs: files-changed diff --git a/.github/workflows/nightly_tests.yaml b/.github/workflows/nightly_tests.yaml index 060b37c3b47..449daf5148b 100644 --- a/.github/workflows/nightly_tests.yaml +++ b/.github/workflows/nightly_tests.yaml @@ -302,3 +302,21 @@ jobs: - uses: ./.github/actions/install-skia-dependencies - name: Build wgpu_texture demo run: cargo apk build -p wgpu_texture --target aarch64-linux-android --lib + + python: + strategy: + matrix: + os: [ubuntu-22.04, macos-14, windows-2022] + uses: ./.github/workflows/python_test_reusable.yaml + with: + name: "Python ${{ matrix.os }}" + os: ${{ matrix.os }} + + node: + strategy: + matrix: + os: [ubuntu-22.04, macos-14, windows-2022] + uses: ./.github/workflows/node_test_reusable.yaml + with: + name: "Node.js ${{ matrix.os }}" + os: ${{ matrix.os }} diff --git a/.github/workflows/node_test_reusable.yaml b/.github/workflows/node_test_reusable.yaml new file mode 100644 index 00000000000..c9dabd12b7f --- /dev/null +++ b/.github/workflows/node_test_reusable.yaml @@ -0,0 +1,62 @@ +# Copyright © SixtyFPS GmbH +# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +name: Node.js Test (Reusable) + +on: + workflow_call: + inputs: + name: + description: 'Name of the job' + required: true + type: string + os: + description: 'Operating system to run on' + required: true + type: string + +env: + RUSTFLAGS: -D warnings + CARGO_PROFILE_DEV_DEBUG: 0 + CARGO_INCREMENTAL: false + RUST_BACKTRACE: 1 + + +jobs: + node_test: + name: ${{ inputs.name }} + runs-on: ${{ inputs.os }} + steps: + - uses: actions/checkout@v5 + - uses: ./.github/actions/install-linux-dependencies + - uses: ./.github/actions/install-skia-dependencies + - name: Setup headless display + if: runner.os != 'macOS' + uses: pyvista/setup-headless-display-action@v4 + - uses: actions/setup-node@v6 + with: + node-version: 20 + package-manager-cache: false + id: node-install + - uses: pnpm/action-setup@v4.2.0 + with: + version: 10.18.2 + - uses: ./.github/actions/setup-rust + with: + key: x-napi-v2-${{ steps.node-install.outputs.node-version }} # the cache key consists of a manually bumpable version and the node version, as the cached rustc artifacts contain linking information where to find node.lib, which is in a versioned directory. + - name: Run pnpm install + working-directory: api/node + run: pnpm install --frozen-lockfile + - name: Build node plugin in debug + run: pnpm build:testing + working-directory: api/node + - name: Run node tests + working-directory: api/node + run: pnpm test + - name: Run test-driver-nodejs + # Release is only applied to the harness that drives the node.js invocations, but needed + # to avoid crashing on Windows with what looks like an out of stack exception. + run: cargo test --verbose --release --all-features -p test-driver-nodejs + - name: Check image-filter example + working-directory: examples/imagefilter/node + run: pnpm check diff --git a/.github/workflows/python_test_reusable.yaml b/.github/workflows/python_test_reusable.yaml new file mode 100644 index 00000000000..23674e60a2d --- /dev/null +++ b/.github/workflows/python_test_reusable.yaml @@ -0,0 +1,64 @@ +# Copyright © SixtyFPS GmbH +# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +name: Python Test (Reusable) + +on: + workflow_call: + inputs: + name: + description: 'Name of the job' + required: true + type: string + os: + description: 'Operating system to run on' + required: true + type: string + +env: + DYLD_FRAMEWORK_PATH: /Users/runner/work/slint/Qt/5.15.2/clang_64/lib + QT_QPA_PLATFORM: offscreen + RUSTFLAGS: -D warnings + CARGO_PROFILE_DEV_DEBUG: 0 + CARGO_INCREMENTAL: false + RUST_BACKTRACE: full + SLINT_BACKEND: winit + +jobs: + python_test: + name: ${{ inputs.name }} + runs-on: ${{ inputs.os }} + steps: + - uses: actions/checkout@v5 + - uses: ./.github/actions/install-linux-dependencies + - name: Install Qt + if: runner.os == 'Linux' + uses: jurplel/install-qt-action@v4 + with: + version: "5.15.2" + setup-python: false + cache: true + - name: Setup headless display + if: runner.os != 'macOS' + uses: pyvista/setup-headless-display-action@v4 + - uses: ./.github/actions/setup-rust + with: + key: x-napi-v2-${{ steps.node-install.outputs.node-version }} # the cache key consists of a manually bumpable version and the node version, as the cached rustc artifacts contain linking information where to find node.lib, which is in a versioned directory. + - uses: actions/setup-python@v6 + with: + python-version: "3.12" + - name: Install uv + uses: astral-sh/setup-uv@v7 + - uses: fjwillemsen/setup-nox2@v3.0.0 + - name: Run python tests + working-directory: api/python/slint + run: nox --default-venv-backend uv + - name: Run mypy + working-directory: api/python/slint + run: uv run mypy -p tests -p slint + - name: Run ruff linter + working-directory: api/python/slint + run: uv tool run ruff check + - name: Run ruff linter + working-directory: api/python/briefcase + run: uv tool run ruff check