jazzband / django-fernet-encrypted-fields

MIT License
47 stars 9 forks source link

setup github actions with black, flake8, testing and coverage #8

Closed hendrikschneider closed 2 years ago

hendrikschneider commented 2 years ago

7 Added github actions test with linting, testing and coverage.

Linting tools:

Coverage:

Currently the ci will run on pull requests but it could also run on each push. What do you prefer?

Here is an example of the ci in action: https://github.com/hendrikschneider/django-fernet-encrypted-fields/actions/runs/2201791942

frgmt commented 2 years ago

I prefer the current one.

StevenMapes commented 2 years ago

I prefer the current one.

@frgmt - Which bit does this relate to? @hendrikschneider changes setup the GitHub actions which are currently missing as well as running linting tools to change the formatting

@hendrikschneider - One thing I would change is to add multiple python versions into the matrix strategy so that it's not just testing Python 3.10

I.E

    strategy:
      matrix:
        django_version: [2.2, 3.0, 3.1, 3.2, 4.0]
        python_version: [3.7, 3.8, 3.9, '3.10']
        exclude:
          # Ignore Django 4 on Python 3.7
          - python_version: 3.7
            django_version: 4.0

and then update the steps

    steps:
    - uses: actions/checkout@v3
    - name: Set up Python ${{ matrix.python_version }}
      uses: actions/setup-python@v3
      with:
        python-version: ${{ matrix.python_version }}

That way it will run 19 jobs covering all 5 Django versions against those four Python versions whilst ensuring Django 4 is skipped with Python 3.7 since it doesn't support it.

frgmt commented 2 years ago

Sorry, this one Currently the ci will run on pull requests.

hendrikschneider commented 2 years ago

@StevenMapes Good idea, I will add these changes. I did not manage yesterday to implement the changes from your comment in #7

hendrikschneider commented 2 years ago

Currently, I switched to run the action when pushing at it makes debugging and running easier.

I also separated linting and testing in different jobs.

Github actions run: https://github.com/hendrikschneider/django-fernet-encrypted-fields/actions/runs/2243730671

StevenMapes commented 2 years ago

Currently, I switched to run the action when pushing at it makes debugging and running easier.

I also separated linting and testing in different jobs.

Github actions run: https://github.com/hendrikschneider/django-fernet-encrypted-fields/actions/runs/2243730671

Question, should the black linting be in the test section where it is now or should it be moved to the top linting section?

Where it is now won't it run per iteration of the test matrix where as the the other lint steps you've moved out will run just the once before hand right? Or is my understanding of how that works wrong, which is very much possible

hendrikschneider commented 2 years ago

@StevenMapes You are right, I oversaw black during copy pasting. It's fixed.