Update branch name and Python versions in workflow #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is a basic workflow to help you get started with Actions | |
| name: Python Linting | |
| # Controls when the action will run. Triggers the workflow on push or pull request | |
| # events but only for the master branch | |
| on: | |
| push: | |
| branches: main | |
| pull_request: | |
| branches: main | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| # This workflow contains a single job called "build" | |
| build: | |
| # The type of runner that the job will run on | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: [pypy3, 3.10, 3.12] | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - uses: actions/checkout@v2 | |
| # Set up a specific version of Python and add the command-line tools to the PATH | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v2 | |
| with: | |
| # Version range or exact version of a Python version to use, using SemVer's version range syntax. | |
| python-version: ${{ matrix.python-version }} # optional, default is 3.x | |
| # The target architecture (x86, x64) of the Python interpreter. | |
| architecture: x64 # optional | |
| # Used to pull python distributions from actions/python-versions. Since there's a default, this is typically not supplied by the user. | |
| token: ${{ github.token }} # optional, default is ${{ github.token }} | |
| # Runs a set of commands using the runners shell | |
| - name: Install Python modules | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install flake8 isort autopep8 | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| # Runs a set of commands using the runners shell | |
| - name: Run Python formatting modules/tools | |
| run: | | |
| cd src/ | |
| isort . | |
| autopep8 --in-place --recursive --max-line-length 127 --aggressive . | |
| # Runs a set of commands using the runners shell | |
| - name: Lint with flake8 | |
| run: | | |
| # stop the build if there are Python syntax errors or undefined names | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |