Skip to content

Commit

Permalink
split linting from testing
Browse files Browse the repository at this point in the history
  • Loading branch information
CM000n committed Dec 22, 2023
1 parent 2d706dc commit efcdc6f
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 24 deletions.
27 changes: 3 additions & 24 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
name: "Linting"
name: "Lint code"

on:
push:
branches: ["master", "main"]
pull_request:

jobs:
pre-commit:
name: "Pre-commit"
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: "ubuntu-latest"
env:
OS: "ubuntu-latest"
PYTHON: "${{ matrix.python-version }}"
steps:
- name: "⤵️ Check out code from GitHub"
uses: "actions/checkout@v4"
- name: "🐍 Set up Python ${{ matrix.python-version }}"
- name: "🐍 Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"
python-version: 3.8
- name: "⚙️ Install Poetry"
uses: "abatilo/[email protected]"
with:
Expand All @@ -31,16 +23,3 @@ jobs:
- name: "🚀 Run pre-commit on all files"
run: |
poetry run pre-commit run --all-files --show-diff-on-failure --color=always
- name: "🚀 Run pytest with coverage"
run: |
poetry run pip install coverage
poetry run coverage run -m pytest
poetry run coverage xml
- name: "⬆️ Upload Coverage to Codecov"
uses: "codecov/codecov-action@v3"
with:
token: "${{ secrets.CODECOV_TOKEN }}"
env_vars: OS,PYTHON
fail_ci_if_error: true
flags: "unittests"
verbose: true
46 changes: 46 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Test code"

env:
COLUMNS: 120

on:
push:
branches: ["master", "main"]
pull_request:

jobs:
pytest:
name: "Pytest"
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: "ubuntu-latest"
env:
OS: "ubuntu-latest"
PYTHON: "${{ matrix.python-version }}"
steps:
- name: "⤵️ Check out code from GitHub"
uses: "actions/checkout@v4"
- name: "🐍 Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"
- name: "⚙️ Install Poetry"
uses: "abatilo/[email protected]"
with:
poetry-version: 1.5.1
- name: "⚙️ Install dependencies"
run: "poetry install"
- name: "🚀 Run pytest with coverage"
run: |
poetry run pip install coverage
poetry run coverage run --source=mytoyota/ -m pytest
poetry run coverage xml
- name: "⬆️ Upload Coverage to Codecov"
uses: "codecov/codecov-action@v3"
with:
token: "${{ secrets.CODECOV_TOKEN }}"
env_vars: OS,PYTHON
fail_ci_if_error: true
flags: "unittests"
verbose: true
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ repos:
hooks:
- id: check-added-large-files
- id: check-yaml
- id: check-json
- id: check-merge-conflict
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- id: no-commit-to-branch
args: [--branch, master, --branch, main]
- repo: https://github.com/python-poetry/poetry
rev: "1.3"
hooks:
Expand Down

0 comments on commit efcdc6f

Please sign in to comment.