diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..9b45cd3a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,32 @@ +name: build + +on: + push: + branches: [ master, dev ] + pull_request: + branches: [ master, dev ] + +jobs: + build: + runs-on: ${{ matrix.platform }} + strategy: + matrix: + platform: + - ubuntu-latest + python-version: ['3.11'] + steps: + - name: Check out code from GitHub + uses: actions/checkout@v3 + - 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.txt + pip install -r requirements_test.txt + pip install tox + - name: Build Wheel + run: | + tox -r -e build diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 8c2f71cd..e42f49f8 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -8,18 +8,15 @@ on: jobs: coverage: - runs-on: ${{ matrix.platform }} + runs-on: ubuntu-latest strategy: - max-parallel: 1 matrix: - platform: - - ubuntu-latest python-version: ['3.11'] - steps: - - uses: actions/checkout@v4 + - name: Check out code from GitHub + uses: actions/checkout@v4.1.6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -28,16 +25,34 @@ jobs: pip install -r requirements.txt pip install -r requirements_test.txt pip install tox - pip install codecov - - name: Test + - name: Run Coverage run: | tox -r -e cov - - name: Codecov - uses: codecov/codecov-action@v3 + - name: Upload coverage + uses: actions/upload-artifact@v4.3.3 with: - fail_ci_if_error: true # optional (default = false) - files: ./coverage.xml - flags: unittests # optional - name: blinkpy - token: ${{ secrets.CODECOV_TOKEN }} # required - verbose: true # optional (default = false) + name: coverage-${{ matrix.python-version }} + path: coverage.xml + overwrite: true + upload-coverage: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.11'] + needs: + - coverage + timeout-minutes: 10 + steps: + - name: Check out code from GitHub + uses: actions/checkout@v4.1.6 + - name: Download all coverage artifacts + uses: actions/download-artifact@v4.1.7 + with: + name: coverage-${{ matrix.python-version }} + path: coverage.xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4.4.1 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + name: blinkpy diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index da2d3818..79ca3f8c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,13 +8,13 @@ on: branches: [ master, dev ] pull_request: branches: [ master, dev ] - jobs: lint: runs-on: ubuntu-latest strategy: + max-parallel: 2 matrix: - python-version: [3.11] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v4 @@ -27,7 +27,12 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt pip install -r requirements_test.txt - pip install tox - - name: Lint + - name: Ruff + run: | + ruff check blinkpy tests blinkapp + - name: Black + run: | + black --check --color --diff blinkpy tests blinkapp + - name: RST-Lint run: | - tox -r -e lint + rst-lint README.rst CHANGES.rst CONTRIBUTING.rst diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d424c132..fad0f0ce 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: build +name: tests on: push: @@ -7,7 +7,7 @@ on: branches: [ master, dev ] jobs: - build: + pytest: runs-on: ${{ matrix.platform }} strategy: max-parallel: 4 @@ -15,9 +15,9 @@ jobs: platform: - ubuntu-latest python-version: ['3.9', '3.10', '3.11', '3.12'] - steps: - - uses: actions/checkout@v3 + - name: Check out code from GitHub + uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -27,7 +27,11 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt pip install -r requirements_test.txt - pip install tox + pip install . - name: Tests run: | - tox -r + python -m pytest \ + --timeout=30 \ + --durations=10 \ + --cov=blinkpy \ + --cov-report term-missing diff --git a/requirements_test.txt b/requirements_test.txt index 107c81b4..1b476ca1 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -2,7 +2,7 @@ ruff==0.4.8 black==24.4.2 build==1.2.1 coverage==7.5.3 -pytest==8.2.1 +pytest==8.2.2 pytest-cov==5.0.0 pytest-sugar==1.0.0 pytest-timeout==2.3.1