Skip to content

Commit

Permalink
Update environment tools
Browse files Browse the repository at this point in the history
- Get rid of Makefile
- Update `pre-commit-config`
- Add CODEOWNERS file
- Update Github Workflow
- Update instructions
- Update dependencies
  • Loading branch information
NikAzanov committed Jun 5, 2024
1 parent f541653 commit 191227b
Show file tree
Hide file tree
Showing 11 changed files with 496 additions and 670 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* nikita.azanov@saritasa.com anton.oboleninov@saritasa.com
30 changes: 17 additions & 13 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: checks
name: CI Checks

on:
push:
Expand All @@ -11,45 +11,49 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
checks:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
fail-fast: false
timeout-minutes: 10

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
id: install-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1.3.4
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ matrix.python-version }}-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
- name: Cache poetry dependencies
id: cached-poetry-dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-${{ steps.install-python.outputs.python-version }}-${{ github.job }}-poetry-${{ hashFiles('**/poetry.lock') }}
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction

- name: Run pre-commit hooks
uses: pre-commit/action@v3.0.0
with:
extra_args: --hook-stage push --all-files
- name: Run checks
run: |
poetry run pre-commit run --hook-stage push --all-files
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ ENV/

# mypy
.mypy_cache/
# pytest
.pytest_cache/
# ruff
.ruff_cache/


#### jetbrains ####
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
Expand Down
24 changes: 16 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-yaml
- id: check-toml
- id: check-json
exclude: ".*\\.vscode/"
- id: end-of-file-fixer
- id: trailing-whitespace
- id: detect-aws-credentials
Expand All @@ -13,25 +14,32 @@ repos:
- id: check-merge-conflict
- id: detect-private-key

- repo: https://github.com/python-poetry/poetry
rev: 1.8.0
hooks:
- id: poetry-check
args: ["--lock"]

# Typo search tool
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.3.0
hooks:
- id: cspell

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
rev: v0.3.7
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format

- repo: https://github.com/asottile/add-trailing-comma
rev: v2.4.0
rev: v3.1.0
hooks:
- id: add-trailing-comma

- repo: https://github.com/pycqa/docformatter
rev: v1.5.1
rev: v1.7.5
hooks:
- id: docformatter
args: [
Expand All @@ -42,10 +50,10 @@ repos:

- repo: local
hooks:
- id: checks
name: run checks
entry: make check
- id: mypy
name: Run mypy
entry: poetry run mypy pytest_qaseio
language: system
pass_filenames: false
types: [ python ]
types: [ file ]
stages: [ push ]
1 change: 0 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"dictionaries": [
"python",
"python-common",
"docker",
"project-related-words"
]
}
1 change: 1 addition & 0 deletions .vscode/project-related-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ getfixturevalue
conftests
makereport
firstresult
ipdb
11 changes: 2 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ We use `pre-commit` for quality control.
To run checks:

```bash
make run-hooks
```

But there are also additional checks available:

```bash
make check
pre-commit run --hook-stage push --all-files
```

## Submitting your code
Expand Down Expand Up @@ -54,5 +48,4 @@ Before submitting your code please do the following steps:
1. Add any changes you want
2. Edit documentation if you have changed something significant
3. Update `CHANGELOG.md` with a quick summary of your changes
4. Run `make check` to ensure that types, pip and safety are correct
5. Run `make run-hooks` to ensure that style is correct
4. Run `pre-commit run --hook-stage push --all-files` to ensure that style and types are correct
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

The MIT License (MIT)
Copyright (c) 2023 Saritasa
Copyright (c) 2023-2024 Saritasa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 0 additions & 18 deletions Makefile

This file was deleted.

Loading

0 comments on commit 191227b

Please sign in to comment.