-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from vil02/add_python_test
chore: add `python_test.yml`
- Loading branch information
Showing
6 changed files
with
112 additions
and
1 deletion.
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,47 @@ | ||
--- | ||
name: python_test | ||
|
||
'on': | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
python_test: | ||
runs-on: ${{matrix.os}} | ||
timeout-minutes: 90 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-20.04 | ||
python-version: ['3.10', 3.11] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{matrix.python-version}} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{matrix.python-version}} | ||
|
||
- name: Install dependencies | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
poetry install --with dev | ||
- name: Lint with ruff | ||
run: | | ||
poetry run ruff check | ||
- name: Run liter | ||
run: | | ||
./check_all_python_scripts.sh | ||
- name: Test with pytest | ||
run: | | ||
poetry run pytest -n 2 | ||
... |
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,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
find . -name "*.py" -exec ./check_python_file.sh {} + |
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,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
declare -i exit_code=0 | ||
|
||
for cur_file in "$@" | ||
do | ||
printf "Checking \"%s\"\n" "${cur_file}" | ||
printf "Checking with pylint:\n" | ||
if ! poetry run pylint "${cur_file}" ; then | ||
exit_code=1 | ||
fi | ||
|
||
printf "Checking with flake8:\n" | ||
if ! poetry run flake8 "${cur_file}" --count --max-line-length=88 --show-source --ignore=E203,W503 ; then | ||
exit_code=1 | ||
fi | ||
|
||
printf "Checking with mypy:\n" | ||
if ! poetry run mypy "${cur_file}"; then | ||
exit_code=1 | ||
fi | ||
done | ||
|
||
if [[ ${exit_code} -eq 0 ]] ; then | ||
printf "\nNo errors found!\n" | ||
fi | ||
|
||
exit "${exit_code}" |
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,29 @@ | ||
[tool.poetry] | ||
name = "adv-2024" | ||
version = "1.0.0" | ||
description = "solutions of Advent of Code 2024" | ||
authors = ["piotr.idzik <vil02_adv@10g.pl>"] | ||
readme = "README.md" | ||
packages = [{include = "solutions"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = ">=3.10,<4.0.0" | ||
|
||
[tool.poetry.group.dev] | ||
optional = true | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
pytest = "8.3.1" | ||
pytest-xdist = "3.5.0" | ||
pylint = "3.2.0" | ||
flake8 = "7.1.1" | ||
flake8-bugbear = "24.10.31" | ||
flake8-pytest-style = "2.0.0" | ||
ruff = "0.7.4" | ||
coverage = "7.5.0" | ||
black = "24.1" | ||
mypy = "1.13.0" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
Empty file.
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