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

feat!: add graphical user interface #10

Merged
merged 18 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 0 additions & 33 deletions .env.example

This file was deleted.

181 changes: 181 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
name: build

on:
workflow_dispatch:
inputs:
build-version:
description: "Build version, e.g. 1.0.0, for app metadata."
required: true
type: string
workflow_call:
inputs:
build-version:
description: "Build version, e.g. 1.0.0, for app metadata."
required: true
type: string
outputs:
macos-artifact:
description: "MacOS artifact name."
value: ${{ jobs.macos.outputs.artifact-name }}
linux-artifact:
description: "Linux artifact name."
value: ${{ jobs.linux.outputs.artifact-name }}
windows-artifact:
description: "Windows artifact name."
value: ${{ jobs.windows.outputs.artifact-name }}

env:
NAME: E-neiler
AUTHOR: NEIAAC
SIGNATURE: com.neiaac.e-neiler

defaults:
run:
shell: bash

jobs:
macos:
runs-on: macos-latest
outputs:
artifact-name: ${{ steps.export.outputs.artifact-name }}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"

- name: Install dependencies
run: pip install .[build]

- name: Build artifact
uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
script-name: src/main.py
onefile: false
standalone: true
include-data-dir: src/resources=resources
macos-create-app-bundle: true
macos-app-icon: src/resources/icons/logo.png
macos-signed-app-name: ${{ env.SIGNATURE }}
macos-app-name: ${{ env.NAME }}
macos-app-version: ${{ inputs.build-version }}
product-version: ${{ inputs.build-version }}
file-version: ${{ inputs.build-version }}
company-name: ${{ env.AUTHOR }}
product-name: ${{ env.NAME }}
file-description: ${{ env.NAME }} app, created by ${{ env.AUTHOR }}.
output-dir: build
enable-plugins: pyside6

- name: Mutate artifact
run: mv build/main.app build/${{ env.NAME }}.app

- name: Set artifact name
id: export
run: echo "artifact-name=${{ env.NAME }}-MacOS-${{ inputs.build-version }}" >> $GITHUB_OUTPUT

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.export.outputs.artifact-name }}
path: build/${{ env.NAME }}*.app
if-no-files-found: error
include-hidden-files: true

linux:
runs-on: ubuntu-latest
outputs:
artifact-name: ${{ steps.export.outputs.artifact-name }}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"

- name: Install dependencies
run: pip install .[build]

- name: Build artifact
uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
script-name: src/main.py
onefile: false
standalone: true
include-data-dir: src/resources=resources
linux-icon: src/resources/icons/logo.png
product-version: ${{ inputs.build-version }}
file-version: ${{ inputs.build-version }}
company-name: ${{ env.AUTHOR }}
product-name: ${{ env.NAME }}
file-description: ${{ env.NAME }} app, created by ${{ env.AUTHOR }}.
output-dir: build
enable-plugins: pyside6

- name: Mutate artifact
run: mv build/main.dist build/${{ env.NAME }}

- name: Set artifact name
id: export
run: echo "artifact-name=${{ env.NAME }}-Linux-${{ inputs.build-version }}" >> $GITHUB_OUTPUT

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.export.outputs.artifact-name }}
path: build/${{ env.NAME }}*
if-no-files-found: error
include-hidden-files: true

windows:
runs-on: windows-latest
outputs:
artifact-name: ${{ steps.export.outputs.artifact-name }}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"

- name: Install dependencies
run: pip install .[build]

- name: Build artifact
uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
script-name: src/main.py
onefile: false
standalone: true
include-data-dir: src/resources=resources
windows-icon-from-ico: src/resources/icons/logo.png
windows-console-mode: disable
product-version: ${{ inputs.build-version }}
file-version: ${{ inputs.build-version }}
company-name: ${{ env.AUTHOR }}
product-name: ${{ env.NAME }}
file-description: ${{ env.NAME }} app, created by ${{ env.AUTHOR }}.
output-dir: build
enable-plugins: pyside6

- name: Mutate artifact
run: mv build/main.dist build/${{ env.NAME }}

- name: Set artifact name
id: export
run: echo "artifact-name=${{ env.NAME }}-Windows-${{ inputs.build-version }}" >> $GITHUB_OUTPUT

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.export.outputs.artifact-name }}
path: build/${{ env.NAME }}*
if-no-files-found: error
include-hidden-files: true
36 changes: 36 additions & 0 deletions .github/workflows/code.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: code

on:
push:
branches: [main]
pull_request_target:

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install Ruff
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run formatter
run: ruff format --check
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install Ruff
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run linter
run: ruff check
13 changes: 6 additions & 7 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ on:
types: [opened, reopened, edited]

jobs:
# Check if the PR has a title that matches the conventional commit format
title:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install commitlint and config-conventional
run: npm install @commitlint/cli @commitlint/config-conventional
- name: Setup commitlint config
- name: Install commitlint
run: |
npm install @commitlint/cli @commitlint/config-conventional
echo 'extends: ["@commitlint/config-conventional"]' > .commitlintrc.yaml
- name: Validate PR title
run: echo "${{ github.event.pull_request.title }}" | npx commitlint
- name: Run commitlint on pull request title
env:
TITLE: ${{ github.event.pull_request.title }}
run: echo "$TITLE" | npx commitlint
39 changes: 36 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,43 @@ permissions:
pull-requests: write

jobs:
python:
metadata:
runs-on: ubuntu-latest
outputs:
major: ${{ steps.metadata.outputs.major }}
minor: ${{ steps.metadata.outputs.minor }}
patch: ${{ steps.metadata.outputs.patch }}
tag-name: ${{ steps.metadata.outputs.tag_name }}
release-created: ${{ steps.metadata.outputs.release_created }}
steps:
- uses: googleapis/release-please-action@v4
- name: Update project metadata and the release pull request
uses: googleapis/release-please-action@v4
id: metadata
with:
# Updates CHANGELOG.md and creates a tagged release in github
release-type: python
build:
needs: [metadata]
if: ${{ needs.metadata.outputs.release-created}}
uses: ./.github/workflows/build.yaml
with:
build-version: ${{ needs.metadata.outputs.major }}.${{ needs.metadata.outputs.minor }}.${{ needs.metadata.outputs.patch }}
upload:
needs: [metadata, build]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Zip build artifacts
run: |
(cd ${{ needs.build.outputs.macos-artifact }} && zip -r ../${{ needs.build.outputs.macos-artifact }}.zip .)
(cd ${{ needs.build.outputs.linux-artifact }} && zip -r ../${{ needs.build.outputs.linux-artifact }}.zip .)
(cd ${{ needs.build.outputs.windows-artifact }} && zip -r ../${{ needs.build.outputs.windows-artifact }}.zip .)
- name: Append build artifacts to release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: >
gh release upload ${{ needs.metadata.outputs.tag-name }}
${{ needs.build.outputs.macos-artifact }}.zip#MacOS
${{ needs.build.outputs.linux-artifact }}.zip#Linux
${{ needs.build.outputs.windows-artifact }}.zip#Windows
29 changes: 29 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: test

on:
push:
branches: [main]
pull_request_target:

jobs:
e2e:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
env:
DISPLAY: ":99.0"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- uses: tlambert03/setup-qt-libs@v1
- if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get install pulseaudio -y
- name: Install dependencies
run: pip install .[test]
- name: Run PyTests
run: pytest
Loading