mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-08-27 23:34:14 +00:00
feat(ci): add GitHub Actions workflow for building and testing on Windows and macOS, including scripts for dependency installation, testing, and artifact uploads
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
# Windows and macOS distributables on GitHub-hosted runners; Linux stays on Gitea.
|
||||
#
|
||||
# - dev branch: lint, tests, then native builds + artifact upload (similar to .gitea/workflows/build-test.yml).
|
||||
# - Any tag push (release, -rc, -dev, etc.): same tests, then builds + artifact upload only (no GitHub Release; Gitea can fetch artifacts later).
|
||||
#
|
||||
# Pinned first-party actions (bump tag and SHA together when upgrading):
|
||||
# actions/checkout@v4.2.2 11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
# actions/setup-python@v5.6.0 a26af69be951a213d495a4c3e4e4022e16d87065
|
||||
# actions/setup-node@v4.4.0 49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
# actions/upload-artifact@v4.6.2 ea165f8d65b6e75b540449e92b4886f43607fa02
|
||||
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
tags:
|
||||
- "*"
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
NODE_OPTIONS: --max-old-space-size=8192
|
||||
PYTHON_VERSION: "3.13"
|
||||
NODE_VERSION: "24"
|
||||
POETRY_VERSION: "2.1.1"
|
||||
PNPM_VERSION: "10.32.1"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Lint and test
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Install Poetry (PyPI pin)
|
||||
env:
|
||||
POETRY_VERSION: ${{ env.POETRY_VERSION }}
|
||||
run: bash scripts/ci/github-install-poetry.sh
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Enable pnpm (corepack)
|
||||
run: corepack enable && corepack prepare "pnpm@${PNPM_VERSION}" --activate
|
||||
|
||||
- name: Install dependencies
|
||||
run: bash scripts/ci/github-install-deps.sh
|
||||
|
||||
- name: Lint and test
|
||||
run: bash scripts/ci/github-run-tests.sh
|
||||
|
||||
windows:
|
||||
name: Windows (portable + NSIS)
|
||||
needs: test
|
||||
if: github.event_name != 'pull_request'
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 120
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Install Poetry (PyPI pin)
|
||||
env:
|
||||
POETRY_VERSION: ${{ env.POETRY_VERSION }}
|
||||
run: bash scripts/ci/github-install-poetry.sh
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Enable pnpm (corepack)
|
||||
run: corepack enable && corepack prepare "pnpm@${PNPM_VERSION}" --activate
|
||||
|
||||
- name: Install dependencies
|
||||
run: bash scripts/ci/github-install-deps.sh
|
||||
|
||||
- name: Build distributables
|
||||
run: bash scripts/ci/github-build-windows.sh
|
||||
|
||||
- name: Upload dist artifacts
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
||||
with:
|
||||
name: meshchatx-windows-${{ github.ref_name }}-${{ github.run_id }}
|
||||
path: dist/
|
||||
if-no-files-found: warn
|
||||
|
||||
macos:
|
||||
name: macOS (universal DMG)
|
||||
needs: test
|
||||
if: github.event_name != 'pull_request'
|
||||
runs-on: macos-latest
|
||||
timeout-minutes: 180
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Install Poetry (PyPI pin)
|
||||
env:
|
||||
POETRY_VERSION: ${{ env.POETRY_VERSION }}
|
||||
run: bash scripts/ci/github-install-poetry.sh
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Enable pnpm (corepack)
|
||||
run: corepack enable && corepack prepare "pnpm@${PNPM_VERSION}" --activate
|
||||
|
||||
- name: Install dependencies
|
||||
run: bash scripts/ci/github-install-deps.sh
|
||||
|
||||
- name: Build distributables
|
||||
run: bash scripts/ci/github-build-macos.sh
|
||||
|
||||
- name: Upload dist artifacts
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
||||
with:
|
||||
name: meshchatx-macos-${{ github.ref_name }}-${{ github.run_id }}
|
||||
path: dist/
|
||||
if-no-files-found: warn
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build macOS universal (x64 + arm64) DMG via electron-builder. Unsigned CI build; signing is disabled.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
export CSC_IDENTITY_AUTO_DISCOVERY=false
|
||||
|
||||
pnpm run dist:mac-universal
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build Windows portable + NSIS installers (electron-builder). See package.json dist:windows.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
git config --global core.longpaths true 2>/dev/null || true
|
||||
|
||||
pnpm run dist:windows
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install Python (Poetry) and Node (pnpm) dependencies for native Electron builds.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
export GIT_TERMINAL_PROMPT=0
|
||||
|
||||
python -m poetry install --no-interaction --no-ansi
|
||||
pnpm install --frozen-lockfile
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install Poetry from PyPI with an explicit version (no third-party installers).
|
||||
# Set POETRY_VERSION to override the default.
|
||||
set -euo pipefail
|
||||
|
||||
POETRY_VERSION="${POETRY_VERSION:-2.1.1}"
|
||||
|
||||
python -m pip install --disable-pip-version-check --upgrade pip
|
||||
python -m pip install --disable-pip-version-check "poetry==${POETRY_VERSION}"
|
||||
python -m poetry --version
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Lint and test (parity with: task lint && task test:all). Used by GitHub Actions.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
poetry run ruff check .
|
||||
poetry run ruff format --check .
|
||||
pnpm run lint
|
||||
poetry run pytest tests/backend --cov=meshchatx/src/backend -q --tb=short
|
||||
pnpm run test -- --exclude tests/frontend/i18n.test.js
|
||||
pnpm run test tests/frontend/i18n.test.js
|
||||
poetry run pytest tests/backend/test_translator_handler.py
|
||||
Reference in New Issue
Block a user