blob: 6a4275ccc5c332cc93cff32c0322c081ba81bc9c (
plain) (
tree)
|
|
name: wee-slack
on: [push, pull_request]
jobs:
lint:
if: >
github.event_name == 'push' || (
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository
)
runs-on: ubuntu-latest
strategy:
matrix:
python_version: [2.7, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python (${{ matrix.python_version }})
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
- uses: actions/cache@v2
env:
cache-name: lint-pip
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-
- name: Install Pipenv
run: |
pip install --upgrade pipenv
- uses: actions/cache@v2
env:
cache-name: lint-pipenv
with:
path: "$GITHUB_WORKSPACE/.venv"
key: ${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-
- name: Install dependencies
run: |
pipenv install --dev --skip-lock
- name: Lint with Flake8
run: |
# stop the build if there are Python syntax errors or undefined names
pipenv run flake8 .
# exit-zero treats all errors as warnings.
pipenv run flake8 . --exit-zero --select=C,E,F,W
- name: Check Python formatting
run: |
pipenv run black --check .
test:
if: >
github.event_name == 'push' || (
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository
)
runs-on: ubuntu-latest
strategy:
matrix:
python_version: [2.7, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python (${{ matrix.python_version }})
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
- uses: actions/cache@v2
env:
cache-name: test-pip
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-
- name: Install Pipenv
run: |
pip install --upgrade pipenv
- uses: actions/cache@v2
env:
cache-name: test-pipenv
with:
path: "$GITHUB_WORKSPACE/.venv"
key: ${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.python_version }}-${{ env.cache-name }}-
- name: Install dependencies
run: |
pipenv install --dev --skip-lock
- name: python/test
run: |
pipenv run pytest
|