Skip to content

Commit

Permalink
ci:add lint to tox
Browse files Browse the repository at this point in the history
  • Loading branch information
bonjourmauko committed Oct 16, 2024
1 parent 33bf4e3 commit 8e9089f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/is-version-number-acceptable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if ! $(dirname "$BASH_SOURCE")/has-functional-changes.sh; then
exit 0
fi

current_version=$(python setup.py --version)
current_version=$(poetry version --short)

if git rev-parse --verify --quiet $current_version; then
echo "Version $current_version already exists in commit:"
Expand Down
25 changes: 12 additions & 13 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Poetry
run: pipx install poetry
- name: Install Tox
run: pipx install tox

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9.20
cache: poetry
cache-dependency-path: poetry.lock

- name: Install dependencies
run: make install
- name: Restore tests
uses: actions/cache@v4
with:
path: |
Makefile
openfisca_extension_template/tests
poetry.lock
tox.ini
key: tests-${{ github.sha }}

- name: Lint files
run: make lint
run: tox -r -e lint

test:
runs-on: ubuntu-22.04
Expand All @@ -94,12 +99,6 @@ jobs:
tox.ini
key: tests-${{ github.sha }}

- name: Restore build
uses: actions/cache@v4
with:
path: dist
key: build-${{ hashFiles('poetry.lock') }}-${{ github.sha }}

- name: Run the test suite
run: tox -r -e py39

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ lint: clean
black --check `git ls-files | grep "\.py$$"`
yamllint `git ls-files | grep "\.yaml$$"`

test: clean lint
test: clean
PYTEST_ADDOPTS="--import-mode importlib" openfisca test --country-package=openfisca_country_template --extensions=openfisca_extension_template openfisca_extension_template/tests
16 changes: 15 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ python_files = "**/*.py"

[tool.tox]
requires = [ "tox>=4.19" ]
env_list = [ "py39", "py310", "py311" ]
env_list = [ "py39", "py310", "py311", "lint" ]

[tool.tox.env_run_base]
allowlist_externals = [ "make" ]
Expand All @@ -110,3 +110,17 @@ commands_pre = [
],
]
commands = [ [ "make", "test" ] ]

[tool.tox.env.lint]
allowlist_externals = [ "make" ]
basepython = [ "py39" ]
commands_pre = [
[
"pip",
"install",
"--find-links",
"dist",
"openfisca_extension_template",
],
]
commands = [ [ "make", "lint" ] ]

0 comments on commit 8e9089f

Please sign in to comment.