Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2/4] [test-built] Improve building workflow #1058

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .circleci/has-functional-changes.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 0 additions & 4 deletions .circleci/publish-python-package.sh

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
Expand Down
7 changes: 0 additions & 7 deletions openfisca_tasks/publish.mk

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion openfisca_tasks/install.mk → tasks/dev.mk
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions tasks/publish.mk
Original file line number Diff line number Diff line change
@@ -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}
File renamed without changes.
File renamed without changes.
File renamed without changes.