|
| 1 | +# This is a workflow to format Python code with black formatter |
| 2 | + |
| 3 | +name: Python Code Style |
| 4 | + |
| 5 | +# Controls when the action will run. Triggers the workflow on push or pull request |
| 6 | +# events but only for the master branch |
| 7 | +on: |
| 8 | + pull_request: |
| 9 | + push: |
| 10 | + branches: [master] |
| 11 | + |
| 12 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 13 | +jobs: |
| 14 | + # The isort job sorts all imports in .py, .pyx, .pxd files |
| 15 | + isort: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + - uses: actions/setup-python@v2 |
| 20 | + - uses: jamescurtin/isort-action@master |
| 21 | + |
| 22 | + black: |
| 23 | + # The type of runner that the job will run on |
| 24 | + runs-on: ubuntu-latest |
| 25 | + |
| 26 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 27 | + steps: |
| 28 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 29 | + - uses: actions/checkout@v2 |
| 30 | + # Set up a Python environment for use in actions |
| 31 | + - uses: actions/setup-python@v2 |
| 32 | + |
| 33 | + # Run black code formatter |
| 34 | + |
| 35 | + with: |
| 36 | + args: ". --check" |
| 37 | + |
| 38 | + flake8: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + |
| 41 | + strategy: |
| 42 | + matrix: |
| 43 | + python-version: [3.7] |
| 44 | + |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v2 |
| 47 | + - name: Set up Python ${{ matrix.python-version }} |
| 48 | + uses: actions/setup-python@v2 |
| 49 | + with: |
| 50 | + python-version: ${{ matrix.python-version }} |
| 51 | + - name: Install dependencies |
| 52 | + run: | |
| 53 | + python -m pip install --upgrade pip |
| 54 | + pip install flake8 |
| 55 | + - name: Lint with flake8 |
| 56 | + uses: py-actions/flake8@v1 |
0 commit comments