diff --git a/.github/workflows/python-lint.yml b/.github/workflows/python-lint.yml index cadaceb..fcb2c1f 100644 --- a/.github/workflows/python-lint.yml +++ b/.github/workflows/python-lint.yml @@ -1,18 +1,19 @@ name: Python Lint on: - push: pull_request: + paths: + - '**/*.py' jobs: pyright: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v5 - name: Set up Node.js (for pyright) - uses: actions/setup-node@v4 + uses: actions/setup-node@v5 with: node-version: 20 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a93c4f2..0057f7e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v5 - name: Run packaging script run: bash ./package.sh diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml new file mode 100644 index 0000000..5ed8c24 --- /dev/null +++ b/.github/workflows/windows-build.yml @@ -0,0 +1,48 @@ +name: Windows Build & Pyright Check + +on: + pull_request: + branches: + - main + paths: + - '**/*.py' + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Set up Node.js (for pyright) + uses: actions/setup-node@v5 + with: + # use the latest Node.js available on the runner/tool-cache + node-version: 'latest' + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install pyright + run: npm install -g pyright + + - name: Run Pyright type check + run: pyright **/*.py + + - name: Install PyInstaller (latest) + run: | + python -m pip install --upgrade pip + pip install pyinstaller + + - name: Build Windows executables + run: ./win-build.cmd + + - name: Upload build artifacts for debugging + uses: actions/upload-artifact@v4 + with: + name: windows-executables + path: | + *.exe diff --git a/.github/workflows/windows-commit-artifacts.yml b/.github/workflows/windows-commit-artifacts.yml new file mode 100644 index 0000000..07f9edb --- /dev/null +++ b/.github/workflows/windows-commit-artifacts.yml @@ -0,0 +1,45 @@ +name: Commit Windows executables on merge + +on: + workflow_run: + workflows: ["Windows Build & Pyright Check"] + types: + - completed + +jobs: + commit-executables: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + + steps: + - name: Checkout main branch + uses: actions/checkout@v5 + with: + ref: main + + - name: Try to download artifact + id: download + uses: actions/download-artifact@v4 + with: + name: windows-executables + path: temp_exe + continue-on-error: true + + - name: Check if artifact exists + run: | + if [ ! -d "temp_exe" ] || [ -z "$(ls -A temp_exe)" ]; then + echo "No artifact found. Exiting workflow." + exit 0 + fi + + - name: Copy executables to repo root + run: | + cp temp_exe/*.exe ./ + + - name: Commit and push updated .exe files + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add *.exe + git diff --quiet && echo "No changes to commit" || git commit -m "Update Windows executables from latest merged PR" + git push origin main diff --git a/gettools.py b/gettools.py index db4b0e9..1c1e997 100644 --- a/gettools.py +++ b/gettools.py @@ -23,6 +23,7 @@ THE SOFTWARE. """ + from __future__ import print_function import os import sys