generated from javidahmed64592/template-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfafa7b
commit 41adb77
Showing
1 changed file
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
black: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.11" | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install pipenv | ||
run: | | ||
pip install pipenv | ||
- name: Install dependencies | ||
run: | | ||
pipenv sync --dev --system | ||
- name: Check format with black | ||
run: | | ||
# stop the build if there are black formatting errors | ||
python -m black --check . | ||
isort: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.11" | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install pipenv | ||
run: | | ||
pip install pipenv | ||
- name: Install dependencies | ||
run: | | ||
pipenv sync --dev --system | ||
- name: Sort imports with isort | ||
run: | | ||
isort . | ||
flake8: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.11" | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install pipenv | ||
run: | | ||
pip install pipenv | ||
- name: Install dependencies | ||
run: | | ||
pipenv sync --dev --system | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 | ||
mypy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.11" | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install pipenv | ||
run: | | ||
pip install pipenv | ||
- name: Install dependencies | ||
run: | | ||
pipenv sync --dev --system | ||
- name: Run mypy | ||
run: | | ||
python -m mypy . | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.11" | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install pipenv | ||
run: | | ||
pip install pipenv | ||
- name: Install dependencies | ||
run: | | ||
pipenv sync --dev --system | ||
- name: Test with pytest | ||
run: | | ||
python -m pytest -vx | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |