diff --git a/.github/is-version-number-acceptable.sh b/.github/is-version-number-acceptable.sh index 2ee4b5f..5648a31 100755 --- a/.github/is-version-number-acceptable.sh +++ b/.github/is-version-number-acceptable.sh @@ -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:" diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 0f4b5a1..ed095e8 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -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 @@ -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 diff --git a/Makefile b/Makefile index 08a9652..94c43d1 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 6ad5d33..3a5e3bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" ] @@ -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" ] ]