Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flatpak support #185

Merged
merged 31 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5b7ba49
Merge in upstream/beta
chase9 Dec 4, 2023
b4f869c
Pass through arguments to flatpak app
chase9 Dec 4, 2023
890c755
add is_flatpak() check
chase9 Dec 4, 2023
2e6ed1d
Fix notifications crashing application
chase9 Dec 4, 2023
8052b4a
WIP: Fix systemd units for Flatpak
chase9 Dec 4, 2023
c207066
Fix installing and running Flatpak
chase9 Dec 18, 2023
bfe0467
Tidy up build files
chase9 Dec 19, 2023
a3d3644
Update check for flatpak environment
chase9 Jan 20, 2024
4e48944
Move repeated flatpak args to a global variable.
chase9 Jan 20, 2024
e3fb1fe
Update flatpak deps
chase9 Jan 20, 2024
47dd739
Change a couple of calls to subprocess to use helper class
chase9 Jan 20, 2024
0ec4a04
Add logic for Kvantum themes in flatpak
chase9 Jan 21, 2024
a861944
Add helpers for finding /usr and /etc
chase9 Apr 6, 2024
87072cb
Update deps and fix flatpak building with poetry
chase9 Apr 7, 2024
0b46f08
Update flatpak to build Poetry deps
chase9 Apr 14, 2024
cd60abb
Add Github action for building Flatpak
chase9 Apr 14, 2024
c50552f
Setup pyright for VSCode usage
chase9 Apr 14, 2024
88fb7bc
Fix pip install path for ci environment
chase9 Apr 14, 2024
2a41bb9
Add VSCode test configs and fix pytest errors
chase9 Apr 15, 2024
c37cdcb
Merge remote-tracking branch 'upstream/beta' into add-flatpak
chase9 Apr 15, 2024
1177eb0
Update workflow to separate building from CI
chase9 Apr 17, 2024
df0f785
New commit to get workflow to run
chase9 Apr 17, 2024
9209b0c
Add cache to base CI workflow
chase9 Apr 17, 2024
fabd5d4
Merge branch 'beta' of github.com:oskarsh/Yin-Yang into add-flatpak
chase9 Apr 19, 2024
0736169
Fix bad import on gtk.py
chase9 Apr 19, 2024
38baf40
Standardize on single quotes
chase9 Apr 19, 2024
0550cf0
Add back in assertion to firefox.py
chase9 Apr 19, 2024
dbae8f2
Remove print statement from colors.py
chase9 Apr 19, 2024
4757a61
Remove unnesseccary TODO and refactor daemon_handler.py
chase9 Apr 19, 2024
5111101
Downgrade required python version to 3.10
chase9 Apr 19, 2024
1820b6a
Move runner.sh to scripts folder
chase9 Apr 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
[flake8]
exclude = resources_rc.py,.venv,main_window.py
exclude =
resources_rc.py,
.venv,
main_window.py
build,
dist
max-line-length = 90
80 changes: 80 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build and Release Yin-Yang

on:
push:
pull_request:

jobs:
build:
name: "Build application as Whl"
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
os: [ubuntu-22.04]
runs-on: ${{matrix.os}}
steps:
# Checkout repo and set up python
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
# Install and configure poetry
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Set up local virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
# Load cached venv if it exists
- name: Cache packages
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
# This path is specific to ubuntu
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
# Install dependencies of cache does not exist
- name: Install system dependencies
run: |
sudo apt install qt6-base-dev libsystemd-dev gcc
- name: Install Poetry dependencies
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --sync --no-interaction
# Compile and build Yin-Yang
- name: Compile ui, translations and resources
run: poetry run ./scripts/build_ui.sh
- name: Build Whl for release
run: poetry build -f wheel -n -o .
# Upload build artifacts for later use
- name: Upload yin-yang whl for flatpak build
uses: actions/upload-artifact@v4
with:
name: yin-yang-${{ github.sha }}-py3-none-any.whl
path: '*.whl'

flatpak:
name: "Build flatpak file"
runs-on: ubuntu-22.04
needs: build
container:
image: bilelmoussaoui/flatpak-github-actions:kde-5.15-23.08
options: --privileged
strategy:
matrix:
arch: [x86_64]
steps:
- uses: actions/checkout@v4
- name: Download build from last step
uses: actions/download-artifact@v4
with:
path: dist/
name: yin-yang-${{ github.sha }}-py3-none-any.whl
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: yin-yang.flatpak
manifest-path: sh.oskar.yin-yang.json
cache-key: flatpak-builder-${{ github.sha }}
arch: x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,36 @@ jobs:
os: [ubuntu-22.04]
runs-on: ${{matrix.os}}
steps:
# Checkout repo and set up python
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
# Install and configure poetry
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Set up local virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
# Load cached venv if it exists
- name: Cache packages
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
# This path is specific to ubuntu
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
# Install dependencies of cache does not exist
- name: Install system dependencies
run: |
sudo apt install qt6-base-dev libsystemd-dev gcc
poetry install
- name: Install Poetry dependencies
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --sync --no-interaction
# Build and test Yin-Yang
- name: Compile ui, translations and resources
run: poetry run ./scripts/build_ui.sh
- name: Lint with flake8
Expand Down
44 changes: 41 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# Created by https://www.toptal.com/developers/gitignore/api/flatpak,python,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=flatpak,python,visualstudiocode
*~
__pycache__
build-test*
build-ui-*
yin_yang/build.py
c_cpp_properties.json
setup.py

# Taken from https://github.com/github/gitignore/blob/main/Python.gitignore
# 12/18/2023
### Flatpak ###
.flatpak-builder
build
build-dir
repo

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -167,3 +174,34 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/flatpak,python,visualstudiocode
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extension-pkg-whitelist=PyQt5
25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug Yin-Yang",
"type": "debugpy",
"request": "launch",
"console": "integratedTerminal",
"module": "yin_yang",
"justMyCode": true
},
{
"name": "Debug Poetry Generator",
"type": "debugpy",
"request": "launch",
"console": "integratedTerminal",
"program": "flatpak-poetry-generator.py",
"justMyCode": true,
"args": ["poetry.lock"]
}
]
}
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
{
}
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"black-formatter.args": [
"--skip-string-normalization"
]
}
Loading