diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index c4e1914e..ea40d03d 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -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/actions-poetry@v2.3.0" with: @@ -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 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 00000000..da2d7b16 --- /dev/null +++ b/.github/workflows/testing.yml @@ -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/actions-poetry@v2.3.0" + 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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e77443a1..ee244193 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: