kbr / fritzconnection

Python-Tool to communicate with the AVM Fritz!Box by the TR-064 protocol and the AHA-HTTP-Interface
MIT License
303 stars 59 forks source link

Add CI to run tests on pull requests #150

Open mib1185 opened 2 years ago

mib1185 commented 2 years ago

Maybe the actions needs to be enabled first on https://github.com/kbr/fritzconnection/settings/actions

working example: https://github.com/mib1185/fritzconnection/pull/1

kbr commented 2 years ago

Thanks, that's something I also have had in mind and wanted to cover in the next months. Seems you have been a bit faster.

mib1185 commented 2 years ago

improved the workflow a bit, so that only the needed tox environment is run, based on the python-version to be tested. I think for the first implementation this should be fine and a good starting point for maybe further future improvements of the CI

kbr commented 2 years ago

Thank you for the work and the time you invested. I'm new to github workflow, therefore it took me also some time to dive into the basics. As far as I understand how it works, tox is not needed as a requirement – because tox does locally the job of github workflow. For a basic quickstart running automatic tests the following (mostly based on your configuration) should be feasible (docs and coverage excluded):

name: Tests

on:
  push:
    branches:
      - master
  pull_request: ~

jobs:
  tests:
    name: Python ${{ matrix.python-version }}
    runs-on: ubuntu-latest

    strategy:
      matrix:
        python-version: [3.6, 3.7, 3.8, 3.9, 3.10]

    steps:
        -uses: actions/checkout@master

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

        -name: Install dependencies
        run: |
            pip install --upgrade pip
            pip install pytest requests

        -name: run tests (pytest)
        run: pytest

But I have to admit, that the @v2 in actions/setup-python@v2 is still unclear for me. Searching the docs reveals to something like "semantic versioning" what makes no sense in this context.

mib1185 commented 2 years ago

@kbr I've changed the workflow, so that tox is not used anymore. If you would enable actions in https://github.com/kbr/fritzconnection/settings/actions (set "Allow all actions and workflows"), you will see the result here in this PR

mib1185 commented 2 years ago

Hi @kbr do you think we can go ahead with this?

kbr commented 2 years ago

Have to dive into this again: because of Ukrain and PyCon DE (yes, unlucky combination) I was engaged otherwise and have to find some timeslots for OSS in the next ...

mib1185 commented 2 years ago

take your time and many thanks for your efforts 🙂

mib1185 commented 1 year ago

Hi @kbr do you mind we could bring this on the road, too? 🙂

Croydon commented 1 month ago

But I have to admit, that the @v2 in actions/setup-python@v2 is still unclear for me. Searching the docs reveals to something like "semantic versioning" what makes no sense in this context.

The @v2 tells the CI to use the git object v2 of the referenced repository for the action. In this case, v2 is a git tag, but it could also be a branch or a git commit. You probably read something from semantic versioning because this particular actions uses semantic versioning for their versioning of their action.