diff --git a/.circleci/config.yml b/.circleci/config.yml index ea7148b39b..4d338eaffd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,11 +19,14 @@ jobs: python -m venv /tmp/venv/openfisca_core echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV + - run: + name: Install build dependencies + command: make install-builder + - run: name: Install dependencies command: | - make install - make clean + make install-deps # pip install --editable git+https://github.com/openfisca/country-template.git@BRANCH_NAME#egg=OpenFisca-Country-Template # use a specific branch of OpenFisca-Country-Template # pip install --editable git+https://github.com/openfisca/extension-template.git@BRANCH_NAME#egg=OpenFisca-Extension-Template # use a specific branch of OpenFisca-Extension-Template @@ -32,9 +35,13 @@ jobs: paths: - /tmp/venv/openfisca_core + - run: + name: Build & install openfisca-core + command: make clean build + - run: name: Run linters - command: make lint + command: make clean lint - run: name: Run openfisca-core tests @@ -151,10 +158,10 @@ jobs: command: if ! .circleci/has-functional-changes.sh ; then circleci step halt ; fi - run: - name: Upload a Python package to Pypi + name: Upload openfisca-core package to PyPi command: | source /tmp/venv/openfisca_core/bin/activate - .circleci/publish-python-package.sh + make install-publisher clean build publish - run: name: Publish a git tag diff --git a/.circleci/has-functional-changes.sh b/.circleci/has-functional-changes.sh index 049a94d6cd..1a909476dc 100755 --- a/.circleci/has-functional-changes.sh +++ b/.circleci/has-functional-changes.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -IGNORE_DIFF_ON="README.md CONTRIBUTING.md Makefile .gitignore LICENSE* .circleci/* .github/* tests/*" +IGNORE_DIFF_ON=".circleci/* .github/* tasks/* tests/* .gitignore conftest.py CONTRIBUTING.md LICENSE* Makefile README.md STYLEGUIDE.md" last_tagged_commit=`git describe --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in master through an unlikely intermediary merge commit diff --git a/.circleci/publish-python-package.sh b/.circleci/publish-python-package.sh deleted file mode 100755 index 8d331bd946..0000000000 --- a/.circleci/publish-python-package.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env bash - -python setup.py bdist_wheel # build this package in the dist directory -twine upload dist/* --username $PYPI_USERNAME --password $PYPI_PASSWORD # publish diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fcb535f9a..82ea091375 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +### 35.5.3 [#1058](https://github.com/openfisca/openfisca-core/pull/1058) + +#### Non-technical changes + +- Moves building workflow to `Makefile`. + ### 35.5.2 [#1048](https://github.com/openfisca/openfisca-core/pull/1048) #### Bug fix diff --git a/Makefile b/Makefile index 2691268681..3e1bea5454 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ -include openfisca_tasks/install.mk -include openfisca_tasks/lint.mk -include openfisca_tasks/publish.mk -include openfisca_tasks/serve.mk -include openfisca_tasks/test_code.mk -include openfisca_tasks/test_doc.mk +include tasks/dev.mk +include tasks/lint.mk +include tasks/publish.mk +include tasks/serve.mk +include tasks/test_code.mk +include tasks/test_doc.mk ## To share info with the user, but no action is needed. print_info = $$(tput setaf 6)[i]$$(tput sgr0) @@ -21,7 +21,7 @@ print_pass = echo $$(tput setaf 2)[✓]$$(tput sgr0) $$(tput setaf 8)$1$$(tput s ## Similar to `print_work`, but this will read the comments above a task, and ## print them to the user at the start of each task. The `$1` is a function ## argument. -print_help = sed -n "/^$1/ { x ; p ; } ; s/\#\#/$(print_work)/ ; s/\./…/ ; x" ${MAKEFILE_LIST} +print_help = sed -n "/^$1/ { x ; p ; } ; s/\#\#/\r$(print_work)/ ; s/\./…/ ; x" ${MAKEFILE_LIST} ## Same as `make`. .DEFAULT_GOAL := all diff --git a/openfisca_tasks/publish.mk b/openfisca_tasks/publish.mk deleted file mode 100644 index 2f34599fd9..0000000000 --- a/openfisca_tasks/publish.mk +++ /dev/null @@ -1,7 +0,0 @@ -## Install openfisca-core for deployment and publishing. -build: setup.py - @## This allows us to be sure tests are run against the packaged version - @## of openfisca-core, the same we put in the hands of users and reusers. - @$(call print_help,$@:) - @python $? bdist_wheel - @find dist -name "*.whl" -exec pip install --force-reinstall {}[dev] \; diff --git a/setup.py b/setup.py index 01e036df50..1935635464 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ setup( name = 'OpenFisca-Core', - version = '35.5.2', + version = '35.5.3', author = 'OpenFisca Team', author_email = 'contact@openfisca.org', classifiers = [ diff --git a/openfisca_tasks/install.mk b/tasks/dev.mk similarity index 91% rename from openfisca_tasks/install.mk rename to tasks/dev.mk index f37d17f26f..f3b59d00cb 100644 --- a/openfisca_tasks/install.mk +++ b/tasks/dev.mk @@ -1,7 +1,7 @@ ## Install project dependencies. install: @$(call print_help,$@:) - @pip install --upgrade pip twine wheel + @pip install --upgrade pip @pip install --editable .[dev] --upgrade --use-deprecated=legacy-resolver ## Uninstall project dependencies. diff --git a/openfisca_tasks/lint.mk b/tasks/lint.mk similarity index 100% rename from openfisca_tasks/lint.mk rename to tasks/lint.mk diff --git a/tasks/publish.mk b/tasks/publish.mk new file mode 100644 index 0000000000..cf56853aea --- /dev/null +++ b/tasks/publish.mk @@ -0,0 +1,27 @@ +## Install building utils. +install-builder: + @$(call print_help,$@:) + @pip install --upgrade pip setuptools wheel + +## Install publishing tools. +install-publisher: + @$(call print_help,$@:) + @pip install --upgrade twine + +## Install build dependencies. +install-deps: + @$(call print_help,$@:) + @python setup.py egg_info + @pip install $$(grep -v "^\[" *.egg-info/requires.txt) + @$(call print_pass,$@:) + +## Build & install openfisca-core for deployment and publishing. +build: + @$(call print_help,$@:) + @python setup.py bdist_wheel + @find dist -name "*.whl" -exec pip install --force-reinstall --no-dependencies {} \; + @$(call print_pass,$@:) + +## Upload openfisca-core package to PyPi. +publish: + @twine upload dist/* --username $${PYPI_USERNAME} --password $${PYPI_PASSWORD} diff --git a/openfisca_tasks/serve.mk b/tasks/serve.mk similarity index 100% rename from openfisca_tasks/serve.mk rename to tasks/serve.mk diff --git a/openfisca_tasks/test_code.mk b/tasks/test_code.mk similarity index 100% rename from openfisca_tasks/test_code.mk rename to tasks/test_code.mk diff --git a/openfisca_tasks/test_doc.mk b/tasks/test_doc.mk similarity index 100% rename from openfisca_tasks/test_doc.mk rename to tasks/test_doc.mk