Skip to content

Commit

Permalink
Poetry & Pytest (#231)
Browse files Browse the repository at this point in the history
* POETRY: init & add pyproject.toml
* add poetry lock file && specify package location for poetry build

* create build job on push
* add poetry action w/ manual pip installs
* cache poetry .venv
* slight caching refactor
* add whl build file

* update github actions to most recent versions

* add pytest as dev dep
* add testing
  • Loading branch information
ischwarz3 authored Mar 16, 2024
1 parent 5316382 commit 5c6bc7b
Show file tree
Hide file tree
Showing 6 changed files with 412 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build eqalert

on: push

permissions:
contents: read

jobs:
build:
strategy:
fail-fast: false
matrix:
python-version: ["3.9.16"]
poetry-version: ["1.7.1"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Define a cache for the virtual environment based on the dependencies lock file
uses: actions/cache@v4
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Manual pip installs
run: |
poetry run pip install --upgrade pip
poetry run pip install --upgrade wheel
poetry run pip install playsound
- name: Install Python deps
run: poetry install --without dev
- name: Build package
run: poetry build
- name: Store build artifact
uses: actions/upload-artifact@v4
with:
name: eqalert-bin
path: |
dist/eqalert-*.tar.gz
dist/eqalert-*.whl
retention-days: 1

33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test eqalert

on: push

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9.16"
- name: Install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: "1.7.1"
- name: Define a cache for the virtual environment based on the dependencies lock file
uses: actions/cache@v4
with:
path: ./.venv
key: venv-dev-${{ hashFiles('poetry.lock') }}
- name: Manual pip installs
run: |
poetry run pip install --upgrade pip
poetry run pip install --upgrade wheel
poetry run pip install playsound
- name: Install Python deps
run: poetry install
- name: Run Tests
run: poetry run pytest
Loading

0 comments on commit 5c6bc7b

Please sign in to comment.