Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: split liniting and testing workflows #256

Merged
merged 4 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
11 changes: 5 additions & 6 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 Expand Up @@ -35,12 +40,6 @@ repos:
entry: poetry run pylint
language: system
types: [python]
- id: pytest-check
name: pytest-check
entry: pytest
language: system
pass_filenames: false
always_run: true
- id: codespell
name: codespell
entry: poetry run codespell --write-changes --skip="./*"
Expand Down
File renamed without changes.