diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 8c28d3e..e04bf02 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -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/release-info-action@v1.3.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/release-info-action@v1.3.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 }} diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index 6f15c9b..5f4fbcf 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -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 }} \ No newline at end of file + - name: Publish to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.pypi_api_key }} + run: pip install twine && twine upload dist/* diff --git a/.github/workflows/run_nox.yml b/.github/workflows/run_nox.yml deleted file mode 100644 index 7cb125b..0000000 --- a/.github/workflows/run_nox.yml +++ /dev/null @@ -1,25 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Run Nox - -on: - pull_request: - workflow_dispatch: - -jobs: - run_all_tests: - name: Run nox - runs-on: ubuntu-latest - steps: - - name: checkout repo - uses: actions/checkout@v4 - - name: setup nox - uses: excitedleigh/setup-nox@main - - name: run nox - run: nox - - name: upload coverage report - if: always() - uses: actions/upload-artifact@v4 - with: - name: coverage-report - path: ///home/runner/work/HABAppRules/HABAppRules/tests/htmlcov diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml new file mode 100644 index 0000000..484130f --- /dev/null +++ b/.github/workflows/run_tests.yml @@ -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 diff --git a/.idea/HABAppRules.iml b/.idea/HABAppRules.iml index 377f53d..e935fb8 100644 --- a/.idea/HABAppRules.iml +++ b/.idea/HABAppRules.iml @@ -15,11 +15,16 @@ + + + - \ No newline at end of file + diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml index a55e7a1..1a0176a 100644 --- a/.idea/codeStyles/codeStyleConfig.xml +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -2,4 +2,4 @@ - \ No newline at end of file + diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml index dd4c951..c57e002 100644 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -4,4 +4,4 @@