Skip to content

Commit

Permalink
Merge pull request #6 from Unmanic/dev-qt5
Browse files Browse the repository at this point in the history
Migrate current package back to Python and build with GitHub Actions
  • Loading branch information
Josh5 authored May 6, 2022
2 parents 94770c0 + 63ed153 commit 175bd92
Show file tree
Hide file tree
Showing 31 changed files with 917 additions and 326 deletions.
168 changes: 168 additions & 0 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: Build and Release

on:
push:
branches: [ "dev-**", "pr-**", "staging", "master" ]
paths-ignore:
- ".github/**"
- "!.github/workflows/**"
- "*.md"
pull_request:
branches: [ staging, master ]

jobs:
BuildWindows:
runs-on: windows-latest
steps:
# Checkout the full history (required for GitVersion to work)
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

# Install NSIS
- name: Install NSIS
run: choco install nsis -y
- name: Print NSIS version
run: makensis -VERSION
- name: Print NSIS compile flags
run: makensis -HDRINFO

# Install libsqlite3
- name: install sqlite
run: choco install sqlite

# Install Python
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.7
- name: Display Python version
run: python --version

# Restore build dependencies cache
- name: Restore build dependencies cache
uses: actions/cache@v3
with:
path: build/dependencies
key: ${{ runner.os }}-build-dependencies-win-${{ hashFiles('build\dependencies\**') }}
restore-keys: |
${{ runner.os }}-build-dependencies-win-
# Install build local dependencies
- name: Install build dependencies
shell: pwsh
run: |
.\scripts\install-tools.ps1
# Execute project build script
- name: Build
id: build-step
shell: pwsh
run: |
.\scripts\build.ps1
$semVer = build\tools\gitversion\gitversion.exe /showvariable SemVer
New-Item dist -ItemType Directory
Move-Item -Path build\nsis\UnmanicLauncher*.exe -Destination dist
$semVer | Out-File dist\VERSION.txt
Write-Output "::set-output name=BUILD_VERSION::$semVer"
# Publish artifacts built in this pipeline
- uses: actions/upload-artifact@v3
with:
name: UnmanicLauncher-Windows
path: dist/

BuildAppImage:
runs-on: ubuntu-20.04
steps:
# Checkout the full history (required for GitVersion to work)
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

# Install Python
- name: Set up Python
uses: actions/setup-python@v3
with:
# Build AppImage with Python 3.8 (same as the output will be)
python-version: 3.8
- name: Display Python version
run: python --version

# Restore build dependencies cache
- name: Restore build dependencies cache
uses: actions/cache@v3
with:
path: build/dependencies
key: ${{ runner.os }}-build-dependencies-lin-${{ hashFiles('build/dependencies/**') }}
restore-keys: |
${{ runner.os }}-build-dependencies-lin-
# Install build local dependencies
- name: Install build dependencies
run: |
./scripts/install-tools-linux.sh
sudo apt-get install -y pkg-config libcairo2-dev gcc python3-dev libgirepository1.0-dev
# Execute project build script
- name: Build
id: build-step
run: |
./scripts/build-linux.sh
semVer=$(build/tools/gitversion/gitversion /showvariable FullSemVer)
if [[ ${GITHUB_REF#refs/*/} == 'master' ]]; then
semVer=$(build/tools/gitversion/gitversion /showvariable SemVer)
fi
mkdir -p dist
mv -v build/UnmanicLauncher-x86_64.AppImage dist/UnmanicLauncher-${semVer}-x86_64.AppImage
echo "${semVer}" > dist/VERSION.txt
echo "::set-output name=BUILD_VERSION::${semVer}"
# Publish artifacts built in this pipeline
- uses: actions/upload-artifact@v3
with:
name: UnmanicLauncher-AppImages
path: dist/

Release:
needs: [ BuildWindows, BuildAppImage ]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
# Fetch Windows artifacts
- name: Download AppImage Artifacts
uses: actions/download-artifact@v2
with:
name: UnmanicLauncher-Windows
path: ./windows/
# Fetch AppImage artifacts
- name: Download AppImage Artifacts
uses: actions/download-artifact@v2
with:
name: UnmanicLauncher-AppImages
path: ./appimages/

# Restore package dist data
- name: Restore package dist data
id: dist-data-step
run: |
mkdir -p ./dist
find ./windows/ -type f -name "*.exe" -exec cp -fn {} ./dist/ \;
find ./windows/ -type f -name "VERSION.txt" -exec cp -fn {} ./dist/ \;
find ./appimages/ -type f -name "*.AppImage" -exec cp -fn {} ./dist/ \;
find ./appimages/ -type f -name "VERSION.txt" -exec cp -fn {} ./dist/ \;
ls -l ./dist/
semVer=$(cat ./dist/VERSION.txt)
echo "::set-output name=BUILD_VERSION::${semVer}"
- name: Release
uses: marvinpinto/action-automatic-releases@latest
with:
automatic_release_tag: v${{ steps.dist-data-step.outputs.BUILD_VERSION }}
title: Release v${{ steps.dist-data-step.outputs.BUILD_VERSION }}
files: |
dist/*.exe
dist/*.AppImage
repo_token: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Ignore build environments
venv/**
build/**
dist/**
installer.configured.cfg

# Ignore IDE config for this project
.idea/**

# Ignore temp files
**/__pycache__
launcher/version.txt
launcher.egg-info
7 changes: 7 additions & 0 deletions config/appimage/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /bin/bash -i
export PYSTRAY_BACKEND=${PYSTRAY_BACKEND:-appindicator}
if [[ "$@" == '--shell' ]]; then
{{ python-executable }}
else
{{ python-executable }} -m launcher "$@"
fi
3 changes: 3 additions & 0 deletions config/appimage/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# AppImage only dependencies
gobject==0.1.0
PyGObject==3.42.1
8 changes: 8 additions & 0 deletions config/appimage/unmaniclauncher.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Type=Application
Name=UnmanicLauncher
Exec=launcher
Comment=Unmanic Launcher
Icon=unmaniclauncher
Categories=System;
Terminal=true
Binary file added config/appimage/unmaniclauncher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions config/appimage/unmaniclauncher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>unmanic</id>
<metadata_license>GPLv3</metadata_license>
<project_license>GPLv3</project_license>
<name>UnmanicLauncher</name>
<summary>Unmanic</summary>
<description>
<p> Python {{ python-fullversion }} with the Unmanic Launcher
bundled in an AppImage.
</p>
</description>
<launchable type="desktop-id">unmanic.desktop</launchable>
<url type="homepage">https://github.com/Unmanic/unmanic-launcher/</url>
<provides>
<binary>python{{ python-version }}</binary>
</provides>
</component>
23 changes: 23 additions & 0 deletions config/windows/installer.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[Application]
name=UnmanicLauncher
version=0.0.1
publisher=Josh.5
entry_point=launcher:main
icon=launcher\assets\icon.ico

[Python]
# Note: Must use Python 3.7 for this distribution of Unmanic on Windows.
# (https://github.com/tornadoweb/tornado/issues/2608)
version=3.7.9
bitness=64
format=bundled

[Include]
packages=launcher
local_wheels=build\dependencies\wheels\*.whl
files=build\dependencies\ffmpeg

[Command launcher]
entry_point=launcher:main

# TODO: Run the updater first after installer
24 changes: 0 additions & 24 deletions installer.cfg

This file was deleted.

77 changes: 0 additions & 77 deletions launcher/UnmanicLauncher.au3

This file was deleted.

19 changes: 19 additions & 0 deletions launcher/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
###
# File: launcher.py
# Project: unmanic-launcher
# File Created: Sunday, 13th March 2022 8:25:09 pm
# Author: Josh Sunnex ([email protected])
# -----
# Last Modified: Thursday, 5th May 2022 10:27:52 pm
# Modified By: Josh.5 ([email protected])
###
# python3 -c "import launcher; launcher.main()"

from .tray import UnmanicLauncher


def main():
launcher = UnmanicLauncher()
launcher.run()
25 changes: 25 additions & 0 deletions launcher/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
###
# File: launcher.py
# Project: unmanic-launcher
# File Created: Sunday, 13th March 2022 8:25:09 pm
# Author: Josh Sunnex ([email protected])
# -----
# Last Modified: Thursday, 28th April 2022 3:22:58 pm
# Modified By: Josh.5 ([email protected])
###
# python3 -m launcher
import argparse
from .tray import UnmanicLauncher

if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--updater', action='store_true')
args = parser.parse_args()
if args.updater:
from .updater import show_window
show_window()
else:
launcher = UnmanicLauncher()
launcher.run()
File renamed without changes.
Loading

0 comments on commit 175bd92

Please sign in to comment.