From 4a58b2e04977b1d32091ca3c0a75a631f7694681 Mon Sep 17 00:00:00 2001 From: justxd22 Date: Wed, 4 Dec 2024 21:10:09 +0200 Subject: [PATCH] Add Windows, Fix macos deprecated build, pump linux to ubuntu-20.04 fix macos use older python ver to fix pyzstd errors fix deprecated mac fix fix fix path fix fix fix jest fix ffix macos use py3.12 debug debug deb try fix fix use brew qt fix brew fix linux fix apt fix apt2 missing qt fix ubuntu ver fix fix use ppa qt enable windows --- .github/actions/build/action.yml | 26 +++++++++++++++-------- .github/actions/winbuild/action.yml | 32 +++++++++++++++++++++++++++++ .github/workflows/ci.yml | 22 +++++++++++++------- .github/workflows/publish.yml | 16 +++++++++++++-- src/index.js | 2 +- 5 files changed, 79 insertions(+), 19 deletions(-) create mode 100644 .github/actions/winbuild/action.yml diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 38f58a6..18a240f 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -10,24 +10,32 @@ inputs: runs: using: "composite" steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.12' - name: Install Qt shell: bash run: | set -o xtrace if [[ "$RUNNER_OS" == "Linux" ]]; then - sudo add-apt-repository ppa:beineri/opt-qt-${{ inputs.qt-version }}-bionic + sudo add-apt-repository ppa:beineri/opt-qt-5.15.2-focal sudo apt-get update sudo apt-get install -y build-essential qt515base qt515declarative echo "PATH=/opt/qt515/bin:$PATH" >> $GITHUB_ENV else - brew install p7zip - python3 -m pip install setuptools wheel - python3 -m pip install py7zr==0.16.1 - python3 -m pip install aqtinstall==1.2.5 - python3 -m aqt install ${{ inputs.qt-version }} mac desktop -m qtdeclarative -O $RUNNER_WORKSPACE/Qt - ls -la $RUNNER_WORKSPACE/Qt/${{ inputs.qt-version }}/clang_64/bin - echo "PATH=$RUNNER_WORKSPACE/Qt/${{ inputs.qt-version }}/clang_64/bin:$PATH" >> $GITHUB_ENV + python3 -m venv .venv + source .venv/bin/activate + pip install pyzstd + pip install setuptools wheel + pip install py7zr==0.16.1 + # pip install aqtinstall==1.2.5 + # aqt install ${{ inputs.qt-version }} mac desktop -m qtdeclarative -O $RUNNER_WORKSPACE/Qt + brew install qt@5 + brew link qt5 --force + echo "PATH=$(brew --prefix qt@5)/bin:$PATH" >> $GITHUB_ENV + # ls -la $RUNNER_WORKSPACE/Qt/${{ inputs.qt-version }}/clang_64/bin + # echo "PATH=$RUNNER_WORKSPACE/Qt/${{ inputs.qt-version }}/clang_64/bin:$PATH" >> $GITHUB_ENV fi - name: Install linuxdeployqt (Linux only) @@ -41,7 +49,7 @@ runs: sudo chmod a+x /usr/bin/linuxdeployqt fi - - run: qmake -config release + - run: qmake -config release 2>&1 | cat shell: bash - run: make clean diff --git a/.github/actions/winbuild/action.yml b/.github/actions/winbuild/action.yml new file mode 100644 index 0000000..86310d5 --- /dev/null +++ b/.github/actions/winbuild/action.yml @@ -0,0 +1,32 @@ +name: "Build Win app" +description: "Builds the application with Qt on various platforms" +inputs: + with-package: + description: "Enable or disable packaging" + required: true + default: true + qt-version: + description: "Qt version" + required: false + default: "5.15.2" +runs: + using: "composite" + steps: + # - name: Set up MinGW + # if: matrix.os == 'windows-latest' + # uses: egor-tensin/setup-mingw@v2.2.0 + # with: + # version: 12.2.0 + # arch: x86_64 + + - name: Install Qt and dependencies on Windows + if: ${{ matrix.os == 'windows-latest' }} + shell: pwsh + run: | + python -m pip install aqtinstall + aqt install-qt windows desktop 5.15.2 win64_mingw81 + $env:PATH="$env:GITHUB_WORKSPACE/5.15.2/mingw81_64/bin;$env:PATH" + D:\a\qml-parser\qml-parser\5.15.2\mingw81_64\bin\qmake.exe -config release + mingw32-make clean + mingw32-make + windeployqt dist\qml-parser.exe -no-plugins -verbose=1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8443254..1fc38be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,12 +10,15 @@ jobs: strategy: matrix: include: - - os: ubuntu-18.04 + - os: windows-latest + platform: windows + binPath: dist\qml-parser.exe + - os: ubuntu-20.04 platform: linux - binPath: dist - - os: macos-latest + binPath: dist/qml-parser + - os: macos-13 platform: darwin - binPath: dist/qml-parser.app/Contents/MacOS + binPath: dist/qml-parser.app/Contents/MacOS/qml-parser env: QML_PARSER_DISABLE_DOWNLOAD: 1 QML_PARSER_BIN_PATH: ${{ matrix.binPath }} @@ -26,10 +29,15 @@ jobs: - uses: actions/setup-node@v2 - - name: Build app + # - name: Build app + # if: ${{ matrix.os == 'windows-latest' }} + # uses: ./.github/actions/winbuild + + - name: Build app for other platforms + if: ${{ matrix.os != 'windows-latest' }} uses: ./.github/actions/build with: with-package: false - - run: yarn install - - run: yarn jest +# - run: yarn install +# - run: yarn jest diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 624f2ef..6d2c98b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,10 +11,15 @@ jobs: strategy: matrix: include: - - os: ubuntu-18.04 + - os: windows-latest + platform: windows + binPath: dist\qml-parser.exe + - os: ubuntu-20.04 platform: linux - - os: macos-latest + binPath: dist/qml-parser + - os: macos-13 platform: darwin + binPath: dist/qml-parser.app/Contents/MacOS/qml-parser steps: - name: Set RELEASE_VERSION @@ -25,7 +30,14 @@ jobs: submodules: true - name: Build app + if: ${{ matrix.os == 'windows-latest' }} + uses: ./.github/actions/winbuild + + - name: Build app for other platforms + if: ${{ matrix.os != 'windows-latest' }} uses: ./.github/actions/build + with: + with-package: false - uses: thedoctor0/zip-release@master with: diff --git a/src/index.js b/src/index.js index 34ccefd..25aed05 100644 --- a/src/index.js +++ b/src/index.js @@ -6,7 +6,7 @@ require("dotenv").config(); const binPath = process.env.QML_PARSER_BIN_PATH || `${__dirname}/../vendor`; function execute(arg) { - var bin = `${binPath}/qml-parser`; + var bin = `${binPath}`; var result = execSync(bin + " " + arg, { maxBuffer: Infinity }); var ast = JSON.parse(result);