From 9e3dc61419dd11aa98b65eaccdbba6dad17b8d65 Mon Sep 17 00:00:00 2001 From: Stelios Tsampas Date: Sun, 11 Sep 2022 20:46:33 +0300 Subject: [PATCH] workflows: Move pyling to check workflow --- .github/workflows/checks.yml | 44 +++++++++ .../{tests.yml => release-tests.yml} | 98 +++++++++++-------- .github/workflows/release.yml | 83 +++++++++++++--- 3 files changed, 169 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/checks.yml rename .github/workflows/{tests.yml => release-tests.yml} (57%) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 00000000..5e3d8880 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,44 @@ + +name: "Checks" + + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - 'rare/**' + pull_request: + types: + - opened + - reopened + - synchronize + branches: + - main + paths: + - 'rare/**' + + +jobs: + pylint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Install Test Dependencies + run: | + python -m pip install --upgrade pip + pip install pylint + - name: Install Target Dependencies + run: | + pip3 install -r requirements.txt + pip3 install -r requirements-presence.txt + - name: Analysis with pylint + run: | + pylint -E rare --disable=E0611,E1123,E1120 --ignore=ui,singleton.py --extension-pkg-whitelist=PyQt5 diff --git a/.github/workflows/tests.yml b/.github/workflows/release-tests.yml similarity index 57% rename from .github/workflows/tests.yml rename to .github/workflows/release-tests.yml index 640f145a..9f3cdb4c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/release-tests.yml @@ -1,30 +1,12 @@ -name: "Test" +name: "Release Tests" + on: workflow_dispatch: -jobs: - pylint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Set up Python 3.10 - uses: actions/setup-python@v2 - with: - python-version: '3.10' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pylint - pip install -r requirements.txt - pip install pypresence - - name: Analysing the code with pylint - run: | - pylint -E rare --disable=E0611,E1123,E1120 --ignore=ui,singleton.py --extension-pkg-whitelist=PyQt5 +jobs: deb-package: runs-on: ubuntu-latest steps: @@ -46,7 +28,8 @@ jobs: makedeb -d mv *.deb Rare.deb - - uses: actions/upload-artifact@v2 + - name: Upload to Artifacts + uses: actions/upload-artifact@v2 with: name: Rare.deb path: build/Rare.deb @@ -72,7 +55,8 @@ jobs: appimage-builder --skip-test mv Rare-*.AppImage Rare.AppImage - - uses: actions/upload-artifact@v2 + - name: Upload to Artifacts + uses: actions/upload-artifact@v2 with: name: Rare.AppImage path: Rare.AppImage @@ -86,19 +70,38 @@ jobs: - uses: actions/setup-python@v2 with: python-version: '3.9' - - name: Dependencies + - name: Install build dependencies + run: pip3 install nuitka ordered-set + - name: Install target dependencies run: | pip3 install -r requirements.txt pip3 install -r requirements-presence.txt - - name: Build Dependencies - run: pip3 install nuitka ordered-set PyQt5-stubs - - name: Build + - name: Version + id: version run: | - python -m nuitka --assume-yes-for-downloads --follow-imports --prefer-source-code --mingw64 --lto=no --jobs=2 --static-libpython=no --standalone --enable-plugin=anti-bloat --enable-plugin=pyqt5 --show-anti-bloat-changes --nofollow-import-to="*.tests" --nofollow-import-to="*.distutils" --include-package-data=qtawesome --include-data-dir=rare\resources\images=rare\resources\images --include-data-files=rare\resources\languages=rare\resources\languages="*.qm" --windows-icon-from-ico=rare\resources\images\Rare.ico --windows-company-name=Rare --windows-product-name=Rare --windows-file-description=rare.exe --windows-file-version=1.9.0 --windows-product-version=1.9.0 --windows-disable-console rare + git fetch --prune --unshallow + echo "::set-output name=tag_offset::$(git describe --long --tags)" + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + - name: Build + run: >- + python -m nuitka + --assume-yes-for-downloads + --follow-imports --prefer-source-code --mingw64 --lto=no --jobs=2 --static-libpython=no --standalone + --enable-plugin=anti-bloat --enable-plugin=pyqt5 --show-anti-bloat-changes --nofollow-import-to="*.tests" + --nofollow-import-to="*.distutils" --include-package-data=qtawesome + --include-data-dir=rare\resources\images=rare\resources\images + --include-data-files=rare\resources\languages=rare\resources\languages="*.qm" + --windows-icon-from-ico=rare\resources\images\Rare.ico + --windows-company-name=Rare --windows-product-name=Rare --windows-file-description=rare.exe + --windows-file-version=0.0.0.0 + --windows-product-version=0.0.0.0 + --windows-disable-console + rare - - uses: actions/upload-artifact@v2 + - name: Upload to Artifacts + uses: actions/upload-artifact@v2 with: - name: Rare-Windows-Nuitka + name: Rare-Windows-${{ steps.version.outputs.tag_offset }} path: rare.dist cx_freeze: @@ -109,19 +112,28 @@ jobs: submodules: true - uses: actions/setup-python@v2 with: - python-version: '3.10' - - name: Dependencies - run: pip3 install -r requirements.txt - - name: cx_freeze + python-version: '3.9' + - name: Install Build Dependencies run: pip3 install --upgrade cx_freeze wheel - - name: pypresence - run: pip3 install pypresence + - name: Install Target Dependencies + run: | + pip3 install -r requirements.txt + pip3 install -r requirements-presence.txt + - name: Version + id: version + run: | + git fetch --prune --unshallow + echo "::set-output name=tag_offset::$(git describe --long --tags)" + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" - name: Build - run: python freeze.py bdist_msi + run: | + python freeze.py bdist_msi + mv dist/*.msi dist/Rare-Windows.msi - - uses: actions/upload-artifact@v2 + - name: Upload to Artifacts + uses: actions/upload-artifact@v2 with: - name: Rare-Windows.msi + name: Rare-Windows-${{ steps.version.outputs.tag_offset }}.msi path: dist/*.msi mac_os: @@ -144,8 +156,12 @@ jobs: run: mv rare/__main__.py __main__.py - name: run pyinstaller - run: | - pyinstaller -F --name Rare --add-data "rare/resources/languages/*:rare/resources/languages" --add-data "rare/resources/images/*:rare/resources/images/" --windowed --icon rare/resources/images/Rare.icns --hidden-import=legendary __main__.py + run: >- + pyinstaller -F --name Rare + --add-data "rare/resources/languages/*:rare/resources/languages" + --add-data "rare/resources/images/*:rare/resources/images/" + --windowed --icon rare/resources/images/Rare.icns + --hidden-import=legendary __main__.py - name: create dmg run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 193af825..391878ac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,12 @@ -name: New Release + +name: "Release" + on: release: types: [ published ] + jobs: pypi-deploy: if: "!github.event.release.prerelease" @@ -48,7 +51,7 @@ jobs: makedeb -d mv *.deb Rare.deb - - name: Upload files to GitHub + - name: Upload to Releases uses: svenstaro/upload-release-action@2.2.1 with: repo_token: ${{ secrets.GITHUB_TOKEN }} @@ -79,7 +82,7 @@ jobs: mv Rare-*.AppImage Rare.AppImage mv Rare-*.AppImage.zsync Rare.AppImage.zsync - - name: Upload AppImage to GitHub + - name: Upload to Releases uses: svenstaro/upload-release-action@2.2.1 with: repo_token: ${{ secrets.GITHUB_TOKEN }} @@ -96,6 +99,49 @@ jobs: tag: ${{ github.ref }} overwrite: true + nuitka: + runs-on: "windows-latest" + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Install build dependencies + run: pip3 install nuitka ordered-set + - name: Install target dependencies + run: | + pip3 install -r requirements.txt + pip3 install -r requirements-presence.txt + - name: Build + run: >- + python -m nuitka + --assume-yes-for-downloads + --follow-imports --prefer-source-code --mingw64 --lto=no --jobs=2 --static-libpython=no --standalone + --enable-plugin=anti-bloat --enable-plugin=pyqt5 --show-anti-bloat-changes --nofollow-import-to="*.tests" + --nofollow-import-to="*.distutils" --include-package-data=qtawesome + --include-data-dir=rare\resources\images=rare\resources\images + --include-data-files=rare\resources\languages=rare\resources\languages="*.qm" + --windows-icon-from-ico=rare\resources\images\Rare.ico + --windows-company-name=Rare --windows-product-name=Rare --windows-file-description=rare.exe + --windows-file-version=${{ github.event.release.tag_name }} + --windows-product-version=${{ github.event.release.tag_name }} + --windows-disable-console + rare + - name: Compress + run: | + python -c "import shutil; shutil.make_archive('Rare-Windows', 'zip', 'rare.dist')" + + - name: Upload to Releases + uses: svenstaro/upload-release-action@2.2.1 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: Rare-Windows.zip + asset_name: Rare-Windows-${{ github.event.release.tag_name }}.zip + tag: ${{ github.ref }} + overwrite: true + cx_freeze: runs-on: "windows-latest" steps: @@ -104,24 +150,27 @@ jobs: submodules: true - uses: actions/setup-python@v2 with: - python-version: '3.8' - - name: Dependencies - run: pip3 install -r requirements.txt - - name: cx_freeze + python-version: '3.9' + - name: Install Build Dependencies run: pip3 install --upgrade cx_freeze wheel + - name: Install Target Dependencies + run: | + pip3 install -r requirements.txt + pip3 install -r requirements-presence.txt - name: Build - run: python freeze.py bdist_msi + run: | + python freeze.py bdist_msi + mv dist/*.msi dist/Rare-Windows.msi - - name: Rename File - run: mv dist/*.msi dist/Rare.msi - - name: Upload to GitHub + - name: Upload to Releases uses: svenstaro/upload-release-action@2.2.1 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: dist/Rare.msi - asset_name: Rare-${{ github.event.release.tag_name }}.msi + file: dist/Rare-Windows.msi + asset_name: Rare-Windows-${{ github.event.release.tag_name }}.msi tag: ${{ github.ref }} overwrite: true + mac_os: runs-on: macos-latest steps: @@ -142,8 +191,12 @@ jobs: run: mv rare/__main__.py __main__.py - name: run pyinstaller - run: | - pyinstaller -F --name Rare --add-data "rare/resources/languages/*:rare/resources/languages" --add-data "rare/resources/images/*:rare/resources/images/" --windowed --icon rare/resources/images/Rare.icns --hidden-import=legendary __main__.py + run: >- + pyinstaller -F --name Rare + --add-data "rare/resources/languages/*:rare/resources/languages" + --add-data "rare/resources/images/*:rare/resources/images/" + --windowed --icon rare/resources/images/Rare.icns + --hidden-import=legendary __main__.py - name: create dmg run: |