Skip to content

Commit

Permalink
Add workflow for building with poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
chase9 committed Apr 7, 2024
1 parent 170d6b3 commit 42c07ab
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 7 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build-py-wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Build python wheel

on:
push:
branches: [beta]
pull_request:
branches: [beta]

jobs:
ci:
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
os: [ubuntu-22.04]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
- 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
- name: Cache packages
uses: actions/cache@v4
with:
# This path is specific to ubuntu
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
run: |
sudo apt install qt6-base-dev libsystemd-dev gcc
poetry install
- name: Compile ui, translations and resources
run: poetry run ./scripts/build_ui.sh
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
poetry run pytest -v
11 changes: 5 additions & 6 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@ name: Python application

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:

runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: "3.12"
- name: Cache pip
uses: actions/cache@v4
with:
Expand All @@ -36,7 +35,7 @@ jobs:
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Compile ui, translations and resources
run: ./scripts/build_ui.sh
run: poetry run ./scripts/build_ui.sh
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
51 changes: 50 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ systemd-python = "235"
requests = "2.31.0"


[tool.poetry.group.DEV.dependencies]
flake8 = "^7.0.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit 42c07ab

Please sign in to comment.