Skip to content

Commit

Permalink
Merge pull request #85 from nobbi1991/update_project_structure
Browse files Browse the repository at this point in the history
Update project structure
  • Loading branch information
nobbi1991 authored Nov 22, 2024
2 parents e730b40 + ab65dfe commit 7262738
Show file tree
Hide file tree
Showing 197 changed files with 16,437 additions and 16,538 deletions.
59 changes: 30 additions & 29 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,39 @@ name: Create Docker Image

on:
release:
types: [published]
types: [published]
workflow_dispatch:

jobs:
buildx:
runs-on: ubuntu-latest
environment: dockerhub
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Get latest release
id: latest_version
uses: abatilo/[email protected].1
with:
owner: nobbi1991
repo: HABAppRules
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ secrets.DOCKER_HUB_USERNAME }}/habapp_rules:latest
${{ secrets.DOCKER_HUB_USERNAME }}/habapp_rules:${{ steps.latest_version.outputs.latest_tag }}
- name: Checkout
uses: actions/checkout@v4
with:
ref: main

- name: Get latest release
id: latest_version
uses: abatilo/[email protected].3
with:
owner: nobbi1991
repo: HABAppRules

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ secrets.DOCKER_HUB_USERNAME }}/habapp_rules:latest
${{ secrets.DOCKER_HUB_USERNAME }}/habapp_rules:${{ steps.latest_version.outputs.latest_tag }}
45 changes: 22 additions & 23 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
name: Publish Python distributions to PyPI
name: Publish Python Package

on:
release:
types: [published]
workflow_dispatch:

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
publish:
runs-on: ubuntu-latest

environment: pypi
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Check out code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install Hatch
run: pip install hatch

- name: Build the package
run: hatch build

- name: Install setuptools
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel twine
- name: Build a binary wheel and a source tarball
run: |
python setup.py sdist bdist_wheel
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_api_key }}
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_api_key }}
run: pip install twine && twine upload dist/*
25 changes: 0 additions & 25 deletions .github/workflows/run_nox.yml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Run Tests

on:
pull_request:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run Pre-Commit Hooks
run: |
pre-commit install
pre-commit run --all-files
unit-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Hatch
run: |
python -m pip install --upgrade pip
pip install hatch
- name: Run Hatch Tests
run: |
hatch run tests:local
- name: Upload Coverage Report on Failure
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report-${{ matrix.python-version }}
path: htmlcov
7 changes: 6 additions & 1 deletion .idea/HABAppRules.iml

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

2 changes: 1 addition & 1 deletion .idea/codeStyles/codeStyleConfig.xml

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

2 changes: 1 addition & 1 deletion .idea/inspectionProfiles/profiles_settings.xml

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

5 changes: 4 additions & 1 deletion .idea/misc.xml

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

2 changes: 1 addition & 1 deletion .idea/modules.xml

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

55 changes: 55 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_install_hook_types: [pre-push]
repos:
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.13.0
# hooks:
# - id: mypy
# args: [--install-types, --non-interactive]
# exclude: ^tests/
# additional_dependencies:
# - pydantic
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/google/yamlfmt
rev: v0.13.0
hooks:
- id: yamlfmt
args: [-conf, .yamlfmt.yaml]
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.10.0-1
hooks:
- id: shfmt
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.18
hooks:
- id: mdformat

- repo: local
hooks:
- id: version-check
name: Check versions
entry: python version_check.py
language: python
pass_filenames: false
additional_dependencies:
- requests
- pytz
5 changes: 5 additions & 0 deletions .yamlfmt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
formatter:
type: basic
eof_newline: true
max_line_length: 120
retain_line_breaks_single: true
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11 as buildimage
FROM python:3.13 as buildimage

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / buildx

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

COPY . /tmp/app_install

Expand All @@ -7,7 +7,7 @@ RUN set -eux; \
cd /tmp/app_install; \
pip wheel --wheel-dir=/root/wheels .

FROM python:3.11
FROM python:3.13

COPY --from=buildimage /root/wheels /root/wheels
COPY container/entrypoint.sh /entrypoint.sh
Expand Down
Loading

0 comments on commit 7262738

Please sign in to comment.