BIN
.gitea/.DS_Store
vendored
Normal file
BIN
.gitea/.DS_Store
vendored
Normal file
Binary file not shown.
54
.gitea/workflows/release.yml
Normal file
54
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements_test.txt
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
python -m pytest tests/ -v
|
||||
|
||||
- name: Update version in manifest
|
||||
run: |
|
||||
python -c "
|
||||
import json
|
||||
import os
|
||||
with open('custom_components/adguard_control_hub/manifest.json', 'r') as f:
|
||||
manifest = json.load(f)
|
||||
manifest['version'] = os.environ['GITHUB_REF_NAME'].lstrip('v')
|
||||
with open('custom_components/adguard_control_hub/manifest.json', 'w') as f:
|
||||
json.dump(manifest, f, indent=2)
|
||||
"
|
||||
|
||||
- name: Create ZIP archive
|
||||
run: |
|
||||
cd custom_components/adguard_control_hub/
|
||||
zip -r ../../adguard-control-hub.zip .
|
||||
cd ../..
|
||||
|
||||
- name: Upload release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./adguard-control-hub.zip
|
||||
asset_name: adguard-control-hub.zip
|
||||
asset_content_type: application/zip
|
||||
80
.gitea/workflows/test.yml
Normal file
80
.gitea/workflows/test.yml
Normal file
@@ -0,0 +1,80 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
pull_request:
|
||||
branches: [main, master]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.13']
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements_test.txt
|
||||
|
||||
- name: Run pytest
|
||||
run: |
|
||||
python -m pytest tests/ -v --tb=short
|
||||
|
||||
- name: Validate manifest
|
||||
run: |
|
||||
python -c "import json; json.load(open('custom_components/adguard_control_hub/manifest.json'))"
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install black isort flake8 mypy
|
||||
|
||||
- name: Run black
|
||||
run: |
|
||||
black --check --diff custom_components/
|
||||
|
||||
- name: Run isort
|
||||
run: |
|
||||
isort --check-only --diff custom_components/
|
||||
|
||||
- name: Run flake8
|
||||
run: |
|
||||
flake8 custom_components/ --max-line-length=88 --extend-ignore=E203,W503
|
||||
|
||||
- name: Run mypy
|
||||
run: |
|
||||
mypy custom_components/
|
||||
continue-on-error: true
|
||||
|
||||
hacs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: HACS validation
|
||||
uses: hacs/action@main
|
||||
with:
|
||||
category: integration
|
||||
Reference in New Issue
Block a user