Skip to content

Commit

Permalink
Merge pull request #261 from tomhea/feature/ci
Browse files Browse the repository at this point in the history
add CI, linters to READMEs, --regular is now fast&medium
  • Loading branch information
tomhea authored Dec 11, 2023
2 parents 235811b + 687f44a commit d993414
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Also, please take 2 minutes to show this project to the people you know that wou
Please, don't use the issue tracker for support-questions. Instead, use the [Questions thread](https://github.com/tomhea/flip-jump/discussions/176), or the [Discussions](https://github.com/tomhea/flip-jump/discussions) in general.

## Responsibilities
* Ensure cross-platform compatibility for every change that's accepted. Windows & Ubuntu Linux.
* Ensure that code that goes into core passes the --regular [tests](tests/README.md).
* Ensure cross-platform compatibility for every change that's accepted. Windows & Ubuntu & Macos.
* Ensure that code that goes into core passes the [ci-tests](tests/README.md#the-ci).
* Create issues (+Discussions) for any major changes and enhancements that you wish to make. Discuss things transparently and get community feedback.
* Don't change the stl-api, only offer new options. feel free to discuss it first.
* Keep each PR as small as possible, preferably one new change/feature per PR.
Expand All @@ -33,7 +33,7 @@ If a maintainer asks you to "rebase" your PR, they're saying that a lot of code
2. Do the changes in your fork (keep them minimal).
3. If you like the change and think the project could use it:
* Be sure you have followed the [code style](CONTRIBUTING.md#clean-code) for the project.
* be sure your project passes the --regular [tests](tests/README.md).
* be sure your project passes the [ci-tests](tests/README.md#the-ci).
* Send a pull request.

If you have **small or "obvious" fixes**, include SMALLFIX in the PR/issue name.
Expand All @@ -42,7 +42,7 @@ such fixes can be:
* Typo correction, white space and formatting changes
* Comment clean up
* Functions/Classes rearrangements in the same file
It should still pass the --regular tests.
It should still pass the [ci-tests](tests/README.md#the-ci).

# How to report a bug
When filing an issue, make sure to answer these five questions:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fj hello_world.fj
- You can use the -o flag to save the assembled file for later use too.
- you can find all the different flags with `fj -h`.

You can also **[Test the project](tests/README.md)** with the project's tests, and with your tests.
You can also **[Test the project](tests/README.md#run-the-tests)** with the project's tests, and with your own tests.

You can also assemble and run separately:

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ fj = 'flipjump.flipjump_cli:main'


[tool.mypy]
files = "flipjump"
strict = true
disable_error_code = ["import-untyped"]

Expand Down
23 changes: 20 additions & 3 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
# The Testing Arena

## Run the tests:
## The CI
The project has a CI tests suit, that runs on each pull-request (using [tox](https://tox.wiki/)):
1. `--regular` tests for all supported python versions, for each os of windows, ubuntu, macos.
2. Linters: [mypy](https://mypy-lang.org/), [flake8](https://flake8.pycqa.org/en/latest/), [bandit](https://bandit.readthedocs.io/en/latest/).
- They run for each os, with the latest supported python.
3. `pytest --all` in parallel.
- Runs on the latest supported python, on ubuntu.

run `pytest` to run the fast tests.
## Run the Linters
- `tox` - will run anything: all the linters + `pytest --regular` for all python versions + `pytest-all`.
- `mypy` - search for types related errors.
- `flake8` - search for style and syntax errors.
- `bandit --ini tox.ini` - search for common security issues.

# Run the tests:

**Run `test_parallel --all` to run all the tests, in parallel.**

Run `pytest --all` to run all the tests.
Run `pytest` to run the fast tests.

Run with `--compile` / `--run` for testing only the compilation / the run.

Add a combination of `--fast`, `--medium`, `--slow`, `--hexlib` to run tests of different types.
Use `--regulr` to run all the tests of stable parts.
Use `--regular` to run all the fast&medium tests.
**====> Use `--all` to run all the tests. <====**
The default (no type flags) means `--fast`.

Expand Down
3 changes: 1 addition & 2 deletions tests/conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"default_type": "fast",
"regular_speed_ordered": [
"fast",
"medium",
"slow"
"medium"
],
"all_speed_ordered": [
"fast",
Expand Down
10 changes: 8 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ python =
[testenv]
setenv = PYTHONPATH = {toxinidir}
deps = .[tests]
commands = pytest --fast --medium
commands = pytest --regular

[testenv:mypy]
basepython = python3.12
commands = mypy flipjump
commands = mypy

[testenv:bandit]
basepython = python3.12
Expand Down Expand Up @@ -54,3 +54,9 @@ per-file-ignores =
flipjump/__init__.py: F401
# redefinition of unused / undefined name
flipjump/assembler/fj_parser.py: F811, F821


[bandit]
recursive = true
targets = flipjump, tests
skips = B101

0 comments on commit d993414

Please sign in to comment.